Mysql Percona XtraDB Cluster(PXC)强制关机后无法启动

在本地虚拟机上装好了pxc,重启物理机之前没有正常关闭虚拟机上pxc。再次开启虚拟机无法启动pxc节点

 

错误日志:

  1. 查看mysql错误日志如下:

  2.  
  3. 2017-07-08 09:05:50 3913 [Note] WSREP: GCache history reset: old(0947d0da-4ffe-11e7-b169-137e84a69003:0) ->

  4. new(0947d0da-4ffe-11e7-b169-137e84a69003:112047)

  5. 2017-07-08 09:05:50 3913 [Note] WSREP: Assign initial position for certification: 112047, protocol version: -1

  6. 2017-07-08 09:05:50 3913 [Note] WSREP: wsrep_sst_grab()

  7. 2017-07-08 09:05:50 3913 [Note] WSREP: Start replication

  8. 2017-07-08 09:05:50 3913 [Note] WSREP: Setting initial position to 0947d0da-4ffe-11e7-b169-137e84a69003:112047

  9. 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.

  10. To force cluster bootstrap with this node, edit the grastate.dat file manually and set safe_to_bootstrap to 1 .

  11. 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

  12. 2017-07-08 09:05:50 3913 [ERROR] Aborting

  13.  
  14. 2017-07-08 09:05:50 3913 [Note] WSREP: Service disconnected.

  15. 2017-07-08 09:05:50 3913 [Note] WSREP: Waiting to close threads......

  16. 2017-07-08 09:05:55 3913 [Note] WSREP: Some threads may fail to exit.

  17. 2017-07-08 09:05:55 3913 [Note] Binlog end

  18. 2017-07-08 09:05:55 3913 [Note] /usr/sbin/mysqld: Shutdown complete

 

 

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

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

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

grastate.dat文件默认在 /var/lib/mysql/下面

修改grastate.dat 的safe_to_bootstrap 的值为1 ,启动成功

 

 

 

另外一个错误:

 [ERROR] WSREP: gcs/src/gcs_group.cpp:group_post_state_exchange():321: Reversing history: 10 -> 7, 
this member has applied 3 more events than the primary component.Data loss is possible. Aborting.

查资料发现需要删除 /var/lib/mysql/grastate.dat 文件 ( 启动不了的节点上 ),然后启动即可。( 原因未知 )

 

 

mysql 在linux环境下 表名区分大小写问题:

修改变量lower-case-table-names

为什么会出现这个问题,主要是因为开发和测试环境不一致导致的,这也是有时测试环境完全没问题,一到生产就出诡异问题的原因之一。所以,我们除了让测试同事认真测试外,最好本地和测试环境还是一致。 
对当前这个问题,我们直接修改SQL中的Empemp即可解决问题,但是为了根本解决问题,我们还须修改mysql的环境变量,也就是将lower_case_table_names的值改为0. 
修改方法: 
1. 找到mysql的安装位置 
2. 找到主目录下的my.ini配置文件 
3. 在[mysqld]节点下添加lower-case-table-names=0 
4. 重启mysql服务 

 

 

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值