前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Percona XtraDB Cluster(PXC)掉电无法正常启动

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

作者头像
Leshami
发布2018-08-13 09:32:49
8900
发布2018-08-13 09:32:49
举报
文章被收录于专栏:乐沙弥的世界乐沙弥的世界

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

一、故障现象

代码语言:javascript
复制
查看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

二、故障分析及解决

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

代码语言:javascript
复制
# 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                              |
+--------------------------+--------------------------------------+
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017年07月07日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、故障现象
  • 二、故障分析及解决
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档