This article mainly introduces the configuration of MySQL master-slave server (one master and multiple slaves). If you are interested, you can learn more about it.
Centos 7.6 installation of MySQL 5.7 please refer to: https://www.jb51.net/article/99965.htm IdeasHost ConfigurationModify confvim /etc/my.cnf
server-id=1 log-bin=master-bin log-bin-index=master-bin.index Restartsystemctl restart mysqld.service # Check the status systemctl status mysqld.service testmysql -u root -p SHOW MASTER STATUS; Slave 1 ConfigurationModify conf vim /etc/my.cnf
server-id=2 relay-log=slave-01-relay-bin relay-log-index=slave-01-relay-bin.index Restart systemctl restart mysqld.service # Check the status systemctl status mysqld.service Slave 2 ConfigurationModify conf vim /etc/my.cnf
server-id=3 relay-log=slave-02-relay-bin relay-log-index=slave-02-relay-bin.index Restart systemctl restart mysqld.service # Check the status systemctl status mysqld.service Configuring master-slave relationshipsHost Configuration
mysql -u root -p CREATE USER 'repl'@'%' IDENTIFIED BY 'Mysql57*'; GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%' IDENTIFIED BY 'Mysql57*'; flush privileges; Slave Configuration mysql -u root -p # My host IP here is 192.168.1.8 change master to master_host='192.168.1.8',master_port=3306,master_user='repl',master_password='Mysql57*',master_log_file='master-bin.000001',master_log_pos=0; start slave; #Stop master-slave synchronization#stop slave; # \G means line break to view show slave status \G;
Test data synchronizationHere the author uses the visualization tool Navicat, readers can also use other tools, just a simple test. Add a new library test-for-repl in the master library, and check whether there is a new library in slave libraries 01 and 02 Add a new table test-create-table in the master library test-for-repl to check whether there is a table in the slave library 01 and 02. Add a new table test-create-table in the master library test-for-repl to check whether there is data in the slave library 01 and 02. Frequently asked questionsThe slave machine checks the master-slave synchronization status show slave status \G; and reports an error
reasonHere, the author used VMware software to create a virtual machine to install Centos7.6 + MySQL5.7, and then used the virtual machine to clone two other virtual machines as slave machines, resulting in the same UUID being generated after MySQL on the three virtual machines is started. Solution
find / -name 'auto.cnf' vim /var/lib/mysql/auto.cnf systemctl restart mysqld.service mysql -u root -p start slave; # \G means line break to view show slave status \G; This is the end of this article about configuring MySQL master-slave server (one master and multiple slaves). For more relevant MySQL master-slave server content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to implement blank space in Taobao with CSS3
>>: html option disable select select disable option example
Table of contents Difference between char and var...
1. Introduction A few days ago, a development col...
Table of contents JVM Class Loader Tomcat class l...
Understand this Perhaps you have seen this in oth...
Table of contents 1. What is Ts 2. Basic Grammar ...
Rancher deployment can have three architectures: ...
The online search to modify the grub startup time...
I'm currently working on my own small program...
Translucent border Result: Implementation code: &...
The answer you often hear is that using a NULL va...
As shown below: nsenter -t 1 -m -u -n -i sh -c &q...
Simple example of adding and removing HTML nodes ...
This article shares the installation and configur...
Start the mysql container in docekr Use command: ...
1. First install the pagoda Installation requirem...