三台节点,一个master,两个slave,规划如下
master | 192.168.153.201 |
slave1 | 192.168.153.152 |
slave2 | 192.168.153.153 |
配置master 1.创建用户并授权,比如我们的用户叫做 repl,创建用户语法如下: create user ‘repl'


至此,主服务器就配置好了。下面来进行配置从服务器 slave1 1.修改my.inf配置文件 [mysqld]server-id=2relay-log-index=slave-relay-bin.indexrelay-log=slave-relay-bin
2.连接Master change master to master_host='192.168.0.104', //Master 服务器Ip master_port=3306, master_user='repl', master_password='mysql', master_log_file='master-bin.000001',//Master服务器产生的日志 master_log_pos=0;
change master to master_host='192.168.153.201',master_port=3306,master_user='repl',master_password='repl',master_log_file='/var/lib/mysql/mysql-bin.000001',master_log_pos=0;
3.查看状态 show slaves status\G



4.启动 start slave
5.关闭 stop slave
6.重置 reset slave