In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the knowledge of "using XtraBackup to build the detailed steps of mysql master-slave replication". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Environment description:
Main library 192.168.123.15, standby library 192.168.123.16
Software download: https://www.percona.com/downloads/XtraBackup/LATEST/
1. Back up the main library root@192.168.123.15
/ apps/percona-xtrabackup-2.4.6/bin/innobackupex-defaults-file=/apps/data/mysql3306.cnf-uroot-pxxxxxxx-slave-info-socket=/tmp/mysql_3306.sock 3306
two。 Package and compress root@192.168.123.15
Tar-zcvf 3306.tar.gz 3306
3. Transfer to standby root@192.168.123.15
Scp 3306.tar.gz 192.168.123.16:/apps/data/backup
4. Decompress and log application root@192.168.123.16
Tar-xvzf 3306.tar.gz
/ apps/percona-xtrabackup-2.4.6/bin/innobackupex-- defaults-file=/apps/data/backup/3306/2017-04-120.009-26-55/backup-my.cnf-- apply-log / apps/data/backup/3306/2017-04-120.009-26-55
5. Stop preparing the library root@192.168.123.16
/ apps/Pmysql5.6.33/bin/mysqladmin-uroot-pxxxxxxx-- socket=/tmp/mysql_3306.sock shutdown
6.copy back root@192.168.123.16
/ apps/percona-xtrabackup-2.4.6/bin/innobackupex-- defaults-file=/apps/data/mysql3306.cnf-- copy-back / apps/data/backup/3306/2017-04-12 09-26-55
7. Start standby root@192.168.123.16
Cd / apps/Pmysql5.6.33
. / bin/mysqld_safe-- defaults-file=/apps/data/mysql3306.cnf &
8. Build replication relationship root@192.168.123.16
View log location
Cat / apps/data/mysql3306/xtrabackup_binlog_pos_innodb
/ apps/Pmysql5.6.33/bin/mysql-uroot-pxxxxxxx-- socket=/tmp/mysql_3306.sock
Show slave status\ G
Stop slave
CHANGE MASTER TO
MASTER_HOST='192.168.123.15'
MASTER_PORT=3306
MASTER_USER='repluser'
MASTER_PASSWORD='xxxxx'
MASTER_LOG_FILE='mysql-bin.000008'
MASTER_LOG_POS=4
Start slave
Show slave status\ G
Attachment: when transferring backup files to the main library, if you do not know the root password, you can configure ssh mutual trust.
# # configure ssh mutual trust # #
1. Log in with the user name user and execute it on machine A.
Ssh-keygen-t rsa
Enter all the way, you don't need to enter the password.
Doing this will generate the id_rsa, id_rsa.pub file under / home/user/.ssh, where id_rsa.pub is the public key.
2. Do step 1 on machine B or create your own / home/user/.ssh folder. Note that the folder permission is set to 700. copy id_rsa.pub to machine B.
Scp id_rsa.pub B:~/.ssh/A.id_rsa.pub
3. Copy the A.id_rsa.pub copied to machine B into the authorized_keys file
Cp A.id_rsa.pub authorized_keys
Or
Cat A.id_rsa.pub > authorized_keys
If there are multiple hosts to access, use > > to add to the authorized_keys file
This is the end of the detailed steps of building mysql master-slave replication with XtraBackup. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.