In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following mainly brings you a brief analysis of Mysql master-slave replication in the case of numerous data. I hope that the master-slave replication analysis of Mysql without data can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.
Mysql master-slave replication (no data case)
Environment:
Centos 6.5
Cmake-3.6.2
Mysql-5.5.53
* * Operation of the main mysql (192.168.1.174) * *
two。 Modify the configuration file
Vi / usr/local/mysql/my.cnf
Add or modify under [mysqld]
Service-id = 1 / / is not the same as id from the library
Log-bin = mysql-bin / / on
3. Establish an account to synchronize with the database
Service mysql start
[root@localhost ~] # mysql-h 127.0.0.1-uroot-p "password" / / Database login password
Mysql > grant replication slave on *. * to 'rep'@'192.168.%.%' identified by' * @ WoP629 $# aslave; / / rep master slave synchronization account * @ WoP629 $# a master slave synchronization password
4. Refresh the system permissions table
Mysql > flush privileges; / / refresh the system permissions table
5. Lock the table; prevent changes to data in the database
Mysql > flush tables with read lock
6. View the status of the main library (important)
Mysql > show master status
These two values should be recorded; synchronize the master library with the slave library.
7. Unlock
Mysql > unlock tables
* * operate from mysql (192.168.1.173) * *
1. Modify the configuration file
Vi / usr/local/mysql/my.cnf
Add or modify under [mysqld]
Service-id = 2 / / is not the same as id from the library
# Log-bin = mysql-bin / / off
two。 Configure synchronization parameters from the library
N service mysql start
N mysql-uroot-p'*@WoP629 $# a'
N mysql > change master to master_host='192.168.1.128',master_user='rep',master_password='*@WoP629 $# a mastery mastery logarithmic filewriting mysqllic bin.000004handwriting mastering logbooks posthumous 337
/ / 192.168.1.174 is the ip address of the main library; rep is the synchronization account; * @ WoP629 $# an is the synchronization password
/ / same as the file name and file location of the main database
3. Turn on synchronization
N mysql > start slave
4. View status from the database
N Mysql > show slave status\ G
5. Test master to create a new good library
An error occurred:
One:
Start the slave server process and view the running status
Mysql > show slave status\ G
If the following line appears, it indicates that the normal startup of Slave_IO_Running: no Slave_SQL_Running: Yes encountered a problem:
Last_IO_Errno: 1593
Last_IO_Error: Fatal error: The slave The slave O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the-- replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
Resolve:
View the server-id of the slave library
# egerp 'server-id | log-bin' my.cnf
See if it's normal.
Two:
Slave_IO_Running: Running
Last_IO_Errno: 2003
Resolve:
It may be caused by nothing to do with the firewall of the main library.
Go to the main library service iptables stop
The meaning of Slave_IO_Running is connecting
There are three main reasons.
1. The network is not connected.
2. The password is incorrect
3. Pos is wrong.
For the above analysis of Mysql master-slave replication in the absence of data, do you think it is very helpful? If you need to know more, please continue to follow our industry information. I'm sure you'll like it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.