【文件属性】:
文件名称:mysql5.7 主从配置docker配置文件
文件大小:2KB
文件格式:RAR
更新时间:2023-04-11 07:34:26
mysql集群 mysql主从同步
该配置文件可以直接放置到目录下,使用docker-compose up -d启动使用。
其中server_id=XX不能重复
在master中执行:
grant replication slave,replication client on *.* to 'user1'@'%' identified by '1';
flush privileges;
show master status;
记录file和pos,用在slave中的master_log_file和master_log_pos中。
在slave中执行:
change master to master_host='192.168.1.147',master_user='user1',master_password='1',master_port=3336,master_log_file='XXX',master_log_pos=XXX,master_connect_retry=30;
start slave;
show slave status\G;
【文件预览】:
dbmasterslave
----master()
--------db()
--------.env(52B)
--------docker-compose.yml(374B)
----slave()
--------db()
--------.env(52B)
--------docker-compose.yml(374B)