mysql主主复制
2022/2/6 2:12:24
本文主要是介绍mysql主主复制,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- M1和M2服务器
grant replication slave,replication client on *.* to 'hanlf'@'%' identified by '123456'; - M1服务器配置
vim /etc/my.cnf
server-id=23
log-bin=mysql-bin
gtid-mode=ON
enforce-gtid-consistency=ON
auto_increment_increment=2
auto_increment_offset=1 - M2服务器配置
vim /etc/my.cnf
server-id=24
log-bin=mysql-bin
gtid-mode=ON
enforce-gtid-consistency=ON
auto_increment_increment=2
auto_increment_offset=2 - M1服务器
change master to master_host='192.168.2.23',master_port=3306,master_user='hanlf',master_password='123456',master_auto_position=1;
start slave; - M2服务器
change master to master_host='192.168.2.24',master_port=3306,master_user='hanlf',master_password='123456',master_auto_position=1;
start slave;
这篇关于mysql主主复制的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-09-21MySQL集群部署资料:新手入门教程
- 2024-09-21MySQL集群资料:初学者入门指南
- 2024-09-21部署MySQL集群资料:新手入门教程
- 2024-09-20MySQL集群部署教程:新手入门指南
- 2024-09-20MySQL集群教程:初学者必备指南
- 2024-09-20部署MySQL集群项目实战:新手入门教程
- 2024-09-20如何部署MySQL集群:简单教程
- 2024-09-20MySQL集群部署:新手入门指南
- 2024-09-20部署MySQL集群学习:入门指南
- 2024-09-20部署MySQL集群入门教程