In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Downtime handling of master database of MySQL master-slave replication
Master library outage Master DOWN-enterprise scenario one master multi-slave downtime slave library switching master continuation and slave synchronization process
Log in to the slave library, show processlist
View the update status of two threads
View all from the library, view
/ application/mysql-5.6.20/data/mysql.info
Make sure the update is complete, and see which of the two slave libraries is the fastest. If there is no delay after testing, the POS gap is very small, or even consistent.
Then select the largest POS as the main library
1. Make sure that all relay log are updated.
Execute stop slave io_thread; show processlist on each slave library
Until you see that Has read all relay log; indicates that the update from the library has been completed:
2. Log in to the slave library with the highest POS value and execute the following command:
Mysql- uroot-p123456-S / application/mysql-5.6.20/mysql.sock
Stop slave
Retset master
Quit
3. Enter the database data directory and delete master.info relay-log.info
Cd / application/mysql-5.6.20/data
Rm-f master.info relay-log.info
Check the authorization table, read-only and other parameters
4. Promote the slave database as the master database
Vim / application/mysql-5.6.20/my.cnf
Enable:
Log-bin = / application/mysql-5.6.20/mysql-bin
/ / be sure to comment out log-slave-updates read-only if it does not exist.
/ application/mysql-5.6.20/mysql restart
This is the end of the promotion of the main library.
5. If the server of the master library is not down, you need to go to the master library binlog to complete it and upgrade the master library to a slave library.
6. Other slave operations
Checked (synchronous user rep exists)
Login slave library
Stop slave
Cahnge master to master_host='10.0.0.7; / / specify the location point if it is not synchronized
Start slave
Show slave status\ G
7. Modify the configuration file of the program from the master database to the slave database (now the new master library)
If you usually access the domain name of the database, you can directly modify the hosts resolution.
8. Repair the damaged master library and use it as a slave library after completion, or switch
We are now talking about the unexpected downtime of the main library, for example, we have a plan to switch, what should we do?
1) the main library locks the table
2) Log in to all libraries to check the synchronization status and whether it is complete
The latter operation is the same as the previous steps 1 to 4.
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.