1,docker pull mysql 分别执行

2,

#在主库上创建同步用户并授权
CREATE USER slave IDENTIFIED BY ‘123456’;
GRANT REPLICATION SLAVE ON *.* TO ‘slave’@‘%’;
FLUSH PRIVILEGES;

#取消slave状态

slave stop ;
change master to master_host=’ ‘;

slave start;

#查看master节点状态,和slave需要的配置参数。

show master status;

stop slave ;
change master to master_host=’192.168.59.128′,master_port=3306,master_user=’root’,master_password=’123456′,master_log_file=’binlog.000003′,master_log_pos=1762;
start slave;

show slave status

如果是Slave_SQL_Running:no:

stop slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;

如果是slave_io_running:no

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注