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

Mariadb 10.3 uses mariabackup backup as the master

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Mariabackup is a new branch of Mariadb based on xtrabackup, which has been installed with mariadb by default.

1. Master database creates master-slave account

Grant replication slave on *. * to 'repl'@'%' identified by "repl"

two。 The main library uses mariabackup to create full backups

Mkdir-p / data/mariabackupmariabackup-- backup-- target-dir=/data/mariabackup-S / var/lib/mysql/mysql.sock-uroot-p123456

3. Prepare to back up data

Mariabackup-prepare-target-dir=/data/mariabackup

4. Send backup data to the slave library

Note: the mysql service needs to be shut down from the library, and all data from the library will be deleted.

From database data location / var/lib/mysql

Cd / data/mariabackuprsync-av. Slave_hostip:/var/lib/mysql

5. Start the database service from the library

Note: before starting the slave library, you need to keep the configuration file of the INNODB of the slave library with the backup-my.cnf in the backup file, otherwise the database may not be started.

# This MySQL options file was generated by innobackupex.# The MySQL server[mysqld] innodb_checksum_algorithm=crc32innodb_data_file_path=ibdata1:12M:autoextendinnodb_log_files_in_group=2innodb_log_file_size=50331648innodb_page_size=16384innodb_undo_directory=./innodb_undo_tablespaces=0

Set file permissions

Chown-R mysql:mysql / var/lib/mysql/

Start the slave library

Systemctl start mysql

6. Set master and slave from the slave library

Check the xtrabackup_binlog_info of the backup file

Mysql-bin.000248 17358780 0-155-1993077

From the above, we know the BINLOG file set from the library and the starting copy location.

Change master to master_host='master_server', master_port=3306,master_user='repl',master_password='repl',MASTER_LOG_FILE='mysql-bin.000248', MASTER_LOG_POS=17358780

Note: it is in the backup file

Xtrabackup_binlog_info-the BINLOG and starting position of the database

Xtrabackup_binlog_pos_innodb-the BINLOG and starting position of the INNODB of the database

Xtrabackup_info-Information of database backup

Normally, if the server's database is INNODB's storage engine, the xtrabackup_binlog_info and xtrabackup_binlog_pos_innodb files are consistent

But if the server has other storage engines such as myisam, the starting position of xtrabackup_binlog_info is larger than xtrabackup_binlog_pos_innodb. So we chose the location stored in the xtrabackup_binlog_info

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

Servers

Wechat

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

12
Report