In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "the installation process operation of mysql master-slave replication". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "mysql master-slave replication installation process operation" it!
Mysql master-slave replication
One master and one slave
1. A brief introduction to the steps of creating two instances, master and slave
two。 Enter the slave library slave and execute the following instructions
# template
CHANGE MASTER TO MASTER_HOST='localhost',MASTER_USER='user',MASTER_PASSWORD='passwd',MASTER_PORT=port,MASTER_AUTO_POSITION=0
# modified sample
CHANGE MASTER TO MASTER_HOST='192.168.180.128',MASTER_USER='replic',MASTER_PASSWORD='oracle',MASTER_PORT=55293,MASTER_AUTO_POSITION=0
Start the slave library
The Start slave picture is as follows
Second, one master and two slaves, use mysql logical backup (dump) (create an empty instance slave1 steps briefly)
Enter the main library master under pressurized environment
Sysbench-threads=10-tables=10-table-size=100000-rand-type=uniform-report-interval=1-time=10-mysql-user=root-mysql-password=oracle-mysql-socket=/mysqldb/db_master1/mysql.sock / usr/share/sysbench/oltp_read_write.lua prepare
Sysbench-threads=10-tables=10-table-size=100000-rand-type=uniform-report-interval=1-time=1000-mysql-user=root-mysql-password=oracle-mysql-socket=/mysqldb/db_master1/mysql.sock / usr/share/sysbench/oltp_read_write.lua run
two。 Backup
Mysqldump-uroot-poracle-S / mysqldb/db_master/mysql.sock-- master-data=2-- single-transaction-- all-database-- set-gtid-purged=OFF-- compact > test.dump
3. Restore
Enter the slave library source test.dump
4. View backup points for binlog
Vi test.dump finds backup point xx writes to MASTER_LOG_POS=xx
5. Master and subordinate are consistent
Enter the new slave library slave1
CHANGE MASTER TO
MASTER_HOST='192.168.180.128'
MASTER_USER='replic'
MASTER_PASSWORD='oracle'
MASTER_PORT=55293
MASTER_LOG_FILE='master1-bin.000004'
MASTER_LOG_POS=194
MASTER_CONNECT_RETRY=10
Start slave in the new slave library slave1
Start slave
Enter the view state from the library
Show slave status\ G
Enter the main library master
Show slave hosts
The above situation and success.
III. Solutions
Encounter the following circumstances
Stop slave # stop slave slave library
Reset slave all # reset slave settings
Make a master-slave connection
CHANGE MASTER TO
MASTER_HOST='192.168.180.128'
MASTER_USER='replic'
MASTER_PASSWORD='oracle'
MASTER_PORT=55293
MASTER_LOG_FILE='master1-bin.000004'
MASTER_LOG_POS=194
MASTER_CONNECT_RETRY=10
Start slave # starts the slave slave library
Show slave status\ G
At this point, I believe that everyone on the "mysql master-slave replication installation process operation" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.