标签:bin 服务器 adb word read star inf mysqldump log
当master服务器宕机,提升一个slave成为新的master
#修改配置文件并关闭read-only配置
[root@slave1 ~] vi /etc/my.cnf.d/mariadb-server.cnf
[mysql]
server-id=81
log-bin
read-only=off
[root@slave1 ~] systemctl restart mariadb.service
#清除旧节点信息
MariaDB [(none)]> set global read_only=off;
MariaDB [(none)]> stop slave;
MariaDB [(none)]> reset slave all;
#备份新master的信息
[root@slave1 ~] mysqldump -A -F --single-transaction --master-data=1> /data/mariadb_backup_`date +%F_%T`.sql
[root@slave1 ~] scp /data/mariadb_backup_2020-10-18_15\:32\:22.sql 10.0.0.82:/data
#其他所有slave还原数据库,指向新master:
[root@slave2 ~] vi /data/mariadb_backup_2020-10-18_11\:33\:25.sql
CHANGE MASTER TO
MASTER_HOST=‘10.0.0.80‘,
MASTER_USER=‘abc‘,
MASTER_PASSWORD=‘123456‘,
MASTER_PORT=3306,
MASTER_LOG_FILE=‘mariadb-bin.000002‘,
MASTER_LOG_POS=389;
MariaDB [(none)]> stop slave;
MariaDB [(none)]> reset slave all;
ariaDB [(none)]> set sql_log_bin=off;
MariaDB [(none)]> source /data/mariadb_backup_2020-10-17_11\:33\:25.sql
MariaDB [(none)]> set sql_log_bin=on;
MariaDB [(none)]> start slave;
当master服务器宕机,提升一个slave成为新的master
标签:bin 服务器 adb word read star inf mysqldump log
原文地址:https://blog.51cto.com/13887323/2542407