Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mariadb primary master replication on centos7

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Mariadb1: 192.168.11.247

Mariadb2: 192.168.11.246

1 mariadb1 configuration

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 configuration

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 restart the mariadb service

Systemctl restart mariadb

4 mariadb1 master, mariadb2 slave configuration

Mariadb1 executes in 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 executes in sql:

# the data of log_file and log_pos are the data obtained by show master status on mariad1

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 master, mariadb1 slave configuration

Mariadb2 executes in 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 executes in sql:

# the data of log_file and log_pos are the data obtained by show master status on mariad2

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

At this point, the master and master synchronous replication configuration is complete.

[click]] (https://www.aigony.com/pages/viewpage.action?pageId=1376296)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report