mysql ab复制 abb

 在三台主机上安装mysql

配置主服务器master

vim /etc/my.cnf 

server_id = 1

log-bin=binlog

log-bin-index=binlog.index

/etc/init.d/mysqld restart

 

创建slave用户:

mysql> GRANT replication slave ON *.* TO 'kang1'@'192.168.1.84' identified by '123'; 

mysql> GRANT replication slave ON *.* TO 'kang2'@'192.168.1.124' identified by '123';
 然后刷新权限:
flush privileges;
配置slave1

vim /etc/my.conf

server_id = 2

relay_log = /var/lib/mysql/mysql-relay-bin

relay_log_index=/var/lib/mysql/mysql-relay-bin.index

log-bin=binlog

log-slave-updates

删除slave1服务器上mysql中的所有文件

rm -fr /var/lib/mysql/*
/etc/init.d/mysqld restart

mysql> change master to master_host='192.168.1.44', master_port=3306, master_user='kang1', master_password='123', master_log_file='binlog.000001',master_log_pos=524;
mysql> start slave;
mysql> show slave status \G
      Slave_IO_Running: Yes
     Slave_SQL_Running: Yes

配置slave2方法同上。

--------------康悦滨


 

你可能感兴趣的:(mysql,abb)