Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Successfully create mysql slave replication through the xtrabackup tool

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces to you the successful creation of mysql slave replication through the xtrabackup tool, the content of the article is carefully selected and edited by the author, with a certain pertinence, and is of great significance to everyone's reference, the following is to understand with the author the successful creation of mysql slave replication through the xtrabackup tool.

If your mysql database has hundreds of gigabytes or even T levels, and you want to do a mysql replication environment, then xtrabackup must be the first. Here are the steps for reference:

1. Create a backup:

Innobackupex-defaults-file=/etc/my.cnf-uroot-pxxxxx-slave-info / backup

Or:

Innobackupex-- defaults-file=/etc/my.cnf-uroot-pxxx / backup

If you do not want to generate a date format file assignment-- no-timestamp:

Innobackupex-defaults-file=/etc/my.cnf-uroot-pxxx-no-timestamp / backup

Use compressed backups:

Innobackupex-- defaults-file=/etc/my.cnf-uroot-pxxxx-- stream=tar / tmp | gzip > / backup/full20190219.tar.gz

Decompress:

Tar-xizf shard120190219.tar.gz

2.scp to the remote machine:

Scp-r 2018-09-24012-41-44 / root@192.168.52.100:/backup

3. Application log:

# innobackupex-- apply-log / backup/2018-09-24012-41-44 /

4. If the machine runs out of space, you can choose not to use-- copy-back, but to use-- move-back, and-- move-back is faster:

/ usr/bin/innobackupex-- copy-back / backup/2018-09-24012-41-44 /

You can also use-- move-back

Innobackupex-defaults-file=/etc/my.cnf-move-back-rsync / backup/2018-09-24 12-41-44 /

5. Modify permissions:

"if you use root for recovery, modify the appropriate directory permissions:"

# chown mysql:mysql-R mysql

Su-mysq

5. Start the database:

Mysqld_safe-defaults-file=/etc/my.cnf-user=mysql &

Shut down the database:

Mysqladmin-uroot-socket=/tmp/mysql.sock-port=3306 shutdown-p

6. The creation of slave,pos and logs can be found in the xtrabackup_info file:

CHANGE MASTER TO MASTER_HOST='192.168.52.99',MASTER_PORT=3306,MASTER_USER='repl',MASTER_PASSWORD='rep#48passw',MASTER_LOG_FILE='mysql-bin.000007',MASTER_LOG_POS=95998982

7. Note:

If your mysql does dual-master replication or cascading replication, and you do not want to start replication when mysql starts, you can set the parameter skip-slave-start = 1, so that mysql will not start replication automatically at startup, and then set it after the replication environment is configured.

Skip-slave-start = 0.

After reading the above about the successful creation of mysql slave replication through xtrabackup tools, many readers must have some understanding. If you need to get more industry knowledge and information, you can continue to follow our industry information column.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report