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

How to implement dual-master replication configuration in mysql

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces mysql how to achieve dual-master replication configuration, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

Two machines, system version CentOS6.5, hostname master and slave,IP address 192.168.57 and 192.168.58, respectively

1. Create replication users on two nodes

At the active node:

Grant replication slave on *. * to 'repl'@'192.168.8.58' identified by' mysql'

At the passive node:

Grant replication slave on *. * to 'repl'@'192.168.8.57' identified by' mysql'

2. Modify the database configuration file

Add the following configuration to the active node:

Server-id = 1

Log-bin = / mysql/data/mysql-bin-3306

Relay-log = relay-log

Read-only = false

Log-slave-updates

Skip-slave-start

Add the following configuration to the passive node:

Server-id = 2

Log-bin = / mysql/data/mysql-bin-3306

Relay-log = relay-log

Read-only = true

Log-slave-updates

3. Configure replication stream

Configure the first replication stream:

Change master to

Master_host='192.168.8.57'

Master_port=3306

Master_user='repl'

Master_password='mysql'

Master_log_file='mysql-bin.000001'

Master_log_pos=154

Master_connect_retry=10

Configure the second replication stream:

Change master to

Master_host='192.168.8.58'

Master_port=3306

Master_user='repl'

Master_password='mysql'

Master_log_file='mysql-bin.000002'

Master_log_pos=154

Master_connect_retry=10

Thank you for reading this article carefully. I hope the article "how to achieve dual-host replication configuration of mysql" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Database

Wechat

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

12
Report