主备配置
主:MySQL 192.168.200.115
从:MySQL 192.168.200.116
从:MySQL 192.168.200.113
主: yum -y install ntp
cp -p /etc/ntp.conf /etc/ntp.conf/origin
vim /etc/ntp.conf--------------------------
server 127.127.1.0
fudge 127.127.1.0 startum 8-------------------
/etc/init.d/ntpd start
chkconfig ntpd on
从:yum -y install ntpdate
ntpdate 192.168.200.115
------------------------------------------------------------------------------------------------------------------
主:
vim /etc/my.cnf---------------------------
server-id = 1
log-bin=mysql-bin
log-slave-updates=true-------------------------------
重启 /etc/init.d/mysqld restart
进入mysql
grant replication slave on *.* to 'myslave'@'192.168.200.%' identified by '123123';
flush privileges;
-------------------------------------------------------------------------------------------
show master staus;
从:
vim /etc/my.cnf
server-id = 2
relay-log=relay-log-bin
relay-log-index=slave-relay-bin.index
重启 mysql
进入mysql
>stop slave;
>change master to master_host='192.168.200.115',master_user='myslave',master_password='123456',master_log_file='mysql-bin.000002',master_log_pos=477;
>start slave;
>show slave status;
--------------------------------------------------------------第二台同上,改一下my.cnf就好
到此,做完
==================================================================
再开一台amoeba
rz 传jdk1.6 和 amoeba-mysql-binary-2.2.0.tar.gz
chmod +x jdk...............
./jdk................
mv jdk....../ /usr/local/jdk1.6
vim /etc/profile---------------------
export JAVA_HOME=/usr/local/jdk1.6
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME:/jre/lib
export AMOEBA_HOME=/usr/local/amoeba/
export PATH=$PATH:$AMOEBA_HOME/bin
-------------------------------------------------------------------
rm rf /usr/local/java
source /etc/profile
java -version
mkdir /usr/local/amoeba
tar xf amoeba................ -C /usr/local/amoeba/
chmod -R 755 /usr/local/amoeba/
/usr/local/amoeba/bin/amoeba
------------------------------------------------------------------------
在另外三台Mysql 授权
grant all on *.* to 'admin'@'192.168.200.%' identified by '123123';
flush privileges;
--------------------------------------------------------------------------------------
amoeba机上
cd /usr/local/amoeba/conf
vim amoeba.xml------------------------------------------------------------------
<property name="defaultPool">master</property>
<property name="writePool">master</property>
<property name="readPool">slaves</property>
--------------------------------------------------------------------------------------------------------
vim dbServers.xml-------------------------------------------------------------------------------------
<property name="password">123</property>
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.200.115</property>
</factoryConfig>
</dbServer>
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.200.116</property>
</factoryConfig>
</dbServer>
<factoryConfig>
<!-- mysql ip -->
<property name="ipAddress">192.168.200.113</property>
</factoryConfig>
</dbServer>
jobs
netstat -anpt|grep java
=======================================================结束
测试
在mysql 里创建库表
不断查看另外两台从mysql 对主的获取库表信息