mysql配置
master端my.cnf配置示例:
1 | [client] |
slave端my.cnf配置示例:
1 | [client] |
master端添加slave端复制账号
1 | CREATE USER 'slave'@'%' IDENTIFIED BY 'xxxxxx'; #slave密码xxxxxx,下面change master时用到 |
获取master信息
1 | # mysql -uroot -p |
slave端设定master
1 | change master to master_host='172.17.0.2', master_user='slave', master_password='xxxxxx', master_port=3306, master_log_file='edu-mysql-bin.000001', master_log_pos=769, master_connect_retry=30; # 172.17.0.3是master的IP,docker中通过docker inspect查看 |
slave启动、查看
1 | mysql> start slave; |