Percona XtraDB Cluster(PXC)掉电无法正常启动

办公室掉电,PXC集群环境无法启动,也就是说整个集群的状态处于丢失的情形。因此需要采取强制的方式来进行,见下面的描述。

一、故障现象

查看mysql错误日志如下:

2017-07-08 09:05:50 3913 [Note] WSREP: GCache history reset: old(0947d0da-4ffe-11e7-b169-137e84a69003:0) -> 
new(0947d0da-4ffe-11e7-b169-137e84a69003:112047)
2017-07-08 09:05:50 3913 [Note] WSREP: Assign initial position for certification: 112047, protocol version: -1
2017-07-08 09:05:50 3913 [Note] WSREP: wsrep_sst_grab()
2017-07-08 09:05:50 3913 [Note] WSREP: Start replication
2017-07-08 09:05:50 3913 [Note] WSREP: Setting initial position to 0947d0da-4ffe-11e7-b169-137e84a69003:112047
2017-07-08 09:05:50 3913 [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 .
2017-07-08 09:05:50 3913 [ERROR] WSREP: wsrep::connect(gcomm://192.168.1.248,192.168.1.249,192.168.1.253) failed: 7
2017-07-08 09:05:50 3913 [ERROR] Aborting

2017-07-08 09:05:50 3913 [Note] WSREP: Service disconnected.
2017-07-08 09:05:50 3913 [Note] WSREP: Waiting to close threads......
2017-07-08 09:05:55 3913 [Note] WSREP: Some threads may fail to exit.
2017-07-08 09:05:55 3913 [Note] Binlog end
2017-07-08 09:05:55 3913 [Note] /usr/sbin/mysqld: Shutdown complete
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

二、故障分析及解决

最好的办法首先就是从日志定位问题的关键。如前所述, 
[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 .

无法从当前节点实现安全引导。原因是当前节点不是集群中最后离开的节点,也就是说当前节点可能未能包含所有的更新。 
如果强制启动当前节点,需要修改grastate.dat文件将safe_to_bootstrap的值置为1。

咋一看,那就从另外一个节点启动吧。当前的集群仅仅配置了2个节点。遗憾的是另外一个节点也收到了同样的错误。 
也就是只能强制启动了。

下面查看grastate.dat,该文件主要描述GALERA保持的状态信息,按指引修改safe_to_bootstrap的值置为1

# more grastate.dat
# GALERA saved state
version: 2.1
uuid:    0947d0da-4ffe-11e7-b169-137e84a69003
seqno:   -1
safe_to_bootstrap: 0

修改safe_to_bootstrap的值为1
# vi grastate.dat 

再次启动正常
# /etc/init.d/mysql bootstrap-pxc

mysql> show variables like 'version';
+---------------+----------------+
| Variable_name | Value          |
+---------------+----------------+
| version       | 5.6.36-82.0-56 |
+---------------+----------------+

mysql> select 'Leshami' Author,'http://blog.csdn.net/leshami' Blog,
    -> '645746311' QQ from dual;
+---------+------------------------------+-----------+
| Author  | Blog                         | QQ        |
+---------+------------------------------+-----------+
| Leshami | http://blog.csdn.net/leshami | 645746311 |
+---------+------------------------------+-----------+

mysql> show global status like 'wsrep_cluster%';
+--------------------------+--------------------------------------+
| Variable_name            | Value                                |
+--------------------------+--------------------------------------+
| wsrep_cluster_conf_id    | 2                                    |
| wsrep_cluster_size       | 2                                    |
| wsrep_cluster_state_uuid | 0947d0da-4ffe-11e7-b169-137e84a69003 |
| wsrep_cluster_status     | Primary                              |
+--------------------------+--------------------------------------+
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值