1024programmer Mysql It’s all here! ! The principle and precautions of MySQL master-slave replication

It’s all here! ! The principle and precautions of MySQL master-slave replication

Mysql TutorialThe column introduces the principle and precautions of master-slave replication

Precautions

(1) The operating system versions and digits of the master and slave servers are consistent;

(2) The master and slave databases The versions must be consistent;

(3) The data in the Master and Slave databases must be consistent;

(4) The Master opens the binary log, and the server_id of the Master and Slave must be unique within the LAN;

Configure master-slave replication steps

Master database

(1) Installation Database;

(2) Modify the database configuration file, specify the server_id, open the binary log (log-bin);

(3) Start the database, check which log is currently, position number How much is it;

(4) Log in to the database and authorize the data replication user (the IP address is the IP address of the slave machine. If it is a two-way master-slave, here you also need to authorize the IP address of the machine. The IP address is the slave IP address);

(5) Backup the database (remember to lock and unlock);

(6) Send the backup data to the Slave;

p>(7) Start the database;

The above steps are successfully built for one-way master-slave, and the steps required to build a two-way master-slave:

(1) Log in to the database and specify the Master Address, user, password and other information (this step is only required for two-way master-slave);

(2) Turn on synchronization and check the status;

Configuration on the Slave

(1) Install the database;

(2) Modify the database configuration file and specify the server_id (if you are building a two-way master-slave, you must also enable the binary log -bin);

(3) Start the database and restore the backup;

(4) Check which log is currently, what is the position number (one-way master-slave step does not need, two-way Master-slave needs);

(5) Specify Master’s address, user, password and other information;

(6) Turn on synchronization and check the status.

Okay, let’s stop here today. In the future, we will implement MySQL master-slave replication in various ways. I am Binghe, and we will see you next time! !

More related free learning recommendations: mysql tutorial(video)

The above is all here! ! For more details on the principle and precautions of MySQL master-slave replication, please pay attention to other related articles on 1024programmer.com!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/its-all-here-the-principle-and-precautions-of-mysql-master-slave-replication/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索