In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following mainly brings you the steps of mysql master-slave replication. I hope these contents can bring you practical use, which is also the main purpose of this article when I edit the steps of mysql master-slave copy. All right, don't talk too much nonsense, let's just read the following.
Master-slave replication step
1: enable the main library binlog function
Check whether 3306 is turned on
Grep log-bin / etc/my.cnf
Check to see if it is different
2: make sure the server-id is different
Grep server-id / etc/my.cnf
Grep server-id / data/3307/my.cnf
3: rep of the user authorized to be copied by the main library
Grant replication slave on *. * to rep@'192.168.1.102' identified by '2017'
Check whether the authorization is successful
4: lock the table and view the binlog location point
Lock the table first to ensure database consistency
Flush table with read lock
Show master status;, look at the backup point.
Show master status
+-+
| | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | |
+-+
| | mysql-bin.000053 | 339 |
+-+
5. New window export complete
Mysqldump-uroot-p2017-A-B-- events-S / tmp/mysql.sock | gzip > / home/chaofu/rep_bak_$ (date +% F) .sql.gz
6: unlock table unlocks the table
From the library:
1: make sure the server-id is different
2: restore the data from the master database to the slave database
Gzip-d rep_bak.sql.gz
Mysql-uroot-p-S / data/3307/mysql.sock < / home/chaofu/rep_bak_2017-11-21.sql
3: find the location point and configure master.info
CHANGE MASTER TO
MASTER_HOST='192.168.1.102'
MASTER_PORT=3306
MASTER_USER='rep'
MASTER_PASSWORD='2017'
MASTER_LOG_FILE='mysql-bin.000053'
MASTER_LOG_POS=339
Find / data/3307/data-type-f-name "* .info"
4: turn on the backup switch
Start slave
Show slave status\ G
Two threads from the library
5: test
For the above steps about mysql master-slave replication, 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.