centos7上mariadb主主复制-成都快上网建站

centos7上mariadb主主复制

mariadb1: 192.168.11.247

成都创新互联公司专注于网站建设,为客户提供做网站、成都网站建设、网页设计开发服务,多年建网站服务经验,各类网站都可以开发,高端网站设计,公司官网,公司展示网站,网站设计,建网站费用,建网站多少钱,价格优惠,收费合理。

mariadb2: 192.168.11.246

1 mariadb1配置
vi /etc/my.cnf.d/server.cnf

[MySQLd]

server-id = 1

log-bin = master-log

relay-log = slave-log

auto_increment_offset = 1

auto_increment_increment = 2

2 mariadb2配置
vi /etc/my.cnf.d/server.cnf

[mysqld]

server-id = 2

log-bin = master-log

relay-log = slave-log

auto_increment_offset = 2

auto_increment_increment = 2

3 重启mariadb服务

systemctl restart mariadb

4 mariadb1主, mariadb2从配置

mariadb1在sql里面执行:
MariaDB [(none)]> create user 'lan'@'192.168.11.%' identified by '666666';
MariaDB [(none)]> grant replication slave on . to 'lan'@'192.168.11.%';
show master status;

mariadb2在sql里面执行:
#log_file和log_pos的数据是mariad1上show master status得到的数据
change master to master_host='192.168.11.247', master_user='lan', master_password='666666', master_log_file='master-log.000001', master_log_pos=498;
start slave;
show slave status\G;

5 mariadb2为主, mariadb1从配置

mariadb2在sql里面执行:
MariaDB [(none)]> create user 'lan'@'192.168.11.%' identified by '666666';
MariaDB [(none)]> grant replication slave on . to 'lan'@'192.168.11.%';
show master status;

mariadb1在sql里面执行:
#log_file和log_pos的数据是mariad2上show master status得到的数据
change master to master_host='192.168.11.246', master_user='lan', master_password='666666', master_log_file='master-log.000001', master_log_pos=498;
start slave;
show slave status\G;

至此, 主主同步复制配置完成,撒花
[详情请点击]](https://www.aigony.com/pages/viewpage.action?pageId=1376296)


当前题目:centos7上mariadb主主复制
当前URL:http://kswjz.com/article/pscphc.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流