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

MySQL 8.0.11 innodb cluster Operation and maintenance Management Manual III add nodes

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

Share

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

MySQL 8.0.11 innodb cluster Operation and maintenance Management Manual III adding Node author Fang Lianchao

Hypothetical

The innodb cluster cluster has been running for a year, and suddenly a node is down. At this time, there is no binlog.000001 in the log. If a slave library is added online, it is officially based on mysqlbackup.

The recovery method, in the rest of the backup from the library, restore on the new library, here are some technical points, I ignored, distressed for a long time.

Create a lab environment:

Frequently manipulate data to be written to the database, switching four binlog. Flush logs, show binary logs

Observe the log time information from the slave library

From the binlog and relay-log of Library 1

From binlog and relay-log of Library 2

As you can see, the master library switches logs, but the slave library does not switch.

Clean up the 1st and 2nd binglog, and then write some data

PURGE MASTER LOGS TO 'binlog.000003'

At this point, a slave library is hung up. Restart the host master library and continue to write data manually. It is found that the slave library is dead. You need to add step 1 full backup: mysqlbackup-- host=127.0.0.1-- port=3310-- user=backup-- password=$-- no-history-logging-- backup-dir=/data/backup/fullbak-- with-timestamp backup-and-apply-log

-- no-history-logging cannot write backup information to the database because it is operating from the database

Step 2: copy to the new slave to restore the slave library

Backup compressed copy to the slave and decompressed

Scp root@192.168.181.105:/data/backup/fullbak/2018-07-25 14-32-32.tar.gz. Tar-xzvf 2018-07-25 14-32-32.tar.gz

Copy the configuration file of the living slave library and modify the information of the replication part of the group.

Step 3: continue to insert data into the main database step 4: restore the new instance

Restore from the database

Mysqlbackup-defaults-file=/data/mysql_3310_test/conf/my.cnf-backup-dir=/data/backup/fullbak/2018-07-26 copy-back-and-apply-log 20-59-35

Step 5: clean up old information

Turn off logging:

Set sql_log_bin=off;use mysqldelete from slave_relay_log_info; delete from slave_master_info; set sql_log_bin=on

Note that it cannot be executed here.

Reset master and reset slave

And

Drop database mysql_innodb_cluster_metadata

Restart the database once, there should be no error.

Step 6 shell delete and add instances

Force deletion of failed instances

Cluster.removeInstance ('root@mysql4:3310', {force:1})

Add instances

Cluster.addInstance ('root@mysql4:3310')

Trampling record

The way of adding members to group replication is different from that of innodb cluster clusters.

. Group replication includes reset master and reset slave operations, as well as setting gtid.

Set @ @ GLOBAL.GTID_PURGED='80d2433f-8f24-11e8Mui a8dfly000c29f1584dpurl 123'

. Innodb cluster, cannot do reset master because the gtid value executed by the backup library is recorded.

You should use mysql shell to delete and add instances

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