其他分享
首页 > 其他分享> > MariaDB Galera Cluster全部节点宕机后恢复

MariaDB Galera Cluster全部节点宕机后恢复

作者:互联网

问题背景

操作系统:CentOS 7.6

DB版本:MariaDB 10.3.20

DB架构:MariaDB Galera Cluster(3个节点)

 

MariaDB Galera Cluster三个节点所在操作系统全部reboot。 

 

启动mariadb.service服务报错如下:

2022-05-12 17:12:55 0 [ERROR] WSREP: It may not be safe to bootstrap the cluster from this node. It was not the last one to leave the cluster and may not contain all the updates. To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .
2022-05-12 17:12:55 0 [ERROR] WSREP: wsrep::connect(gcomm://172.18.143.110,172.18.143.111,172.18.143.112) failed: 7
2022-05-12 17:12:55 0 [ERROR] Aborting

解决办法

通过last -x reboot命令查看三个节点操作系统重启的时间,可以确认节点3是最后一个关闭数据库服务:

 

三个节点的grastate.dat文件内容一致:

cat /var/lib/mysql/grastate.dat
# GALERA saved state
version: 2.1
uuid:    00000000-0000-0000-0000-000000000000    #不包括此行
seqno:   -1
safe_to_bootstrap: 0

 

三个节点的mariadb.service服务为非正常关闭:

seqno:   -1
safe_to_bootstrap: 0

 

修改MariaDB安全引导参数:

[root]# vi /var/lib/mysql/grastate.dat
safe_to_bootstrap: 1

 

依次启动mariadb.service集群恢复正常。

 

 参考:https://galeracluster.com/library/training/tutorials/restarting-cluster.html

标签:Galera,safe,12,宕机,bootstrap,Cluster,2022,MariaDB,节点
来源: https://www.cnblogs.com/haha029/p/16264801.html