pxc丛节点启动失败案例
pxc1主节点未正确关闭mysql,再次启动的时候
[root@pxc1 ~]# /etc/init.d/mysql bootstrap-pxc
Bootstrapping PXC (Percona XtraDB Cluster) ERROR! MySQL (Percona XtraDB Cluster) is not running, busys/mysql) exists
Starting MySQL (Percona XtraDB Cluster). SUCCESS!
然后我关闭了丛节点pxc2,pxc3
[root@pxc1 ~]# /etc/init.d/mysql
Usage: mysql {start|stop|restart|restart-bootstrap|reload|force-reload|status|bootstrap-pxc} [ MyS) options ]
注意pxc主节点启动的时候,不要直接使用start和restart
[root@pxc1 ~]# /etc/init.d/mysql restart-bootstrap
Shutting down MySQL (Percona XtraDB Cluster).... SUCCESS!
Bootstrapping PXC (Percona XtraDB Cluster)Starting MySQL (Percona XtraDB Cluster). SUCCESS!
然后再启动pxc2和pxc3,分别报错如下:
[root@pxc2 ~]# /etc/init.d/mysql start
Starting MySQL (Percona XtraDB Cluster). ERROR! The server quit without updating PID file (/var/lib
ERROR! MySQL (Percona XtraDB Cluster) server startup failed!
[root@pxc3 ~]# /etc/init.d/mysql start
Starting MySQL (Percona XtraDB Cluster)................................ ERROR! The server quit withr/lib/mysql/pxc3.pid).
ERROR! MySQL (Percona XtraDB Cluster) server startup failed!
第一时间果断查看日志,报错日志分别如下:
[root@pxc2 ~]# tail -100 /var/lib/mysql/pxc2.err
…………
…………
…………
2016-09-06 03:50:21 10755 [ERROR] WSREP: gcs/src/gcs_group.cpp:group_post_state_exchange():321: Reversing history: 86192 -> 86031, this member has applied 161 more events than the primary component.Data loss is possible. Aborting.
2016-09-06 03:50:21 10755 [Note] WSREP: /usr/sbin/mysqld: Terminated.
160906 03:50:21 mysqld_safe mysqld from pid file /var/lib/mysql/pxc2.pid ended
[root@pxc3 ~]# tail -100 /var/lib/mysql/pxc3.err
2016-09-06 03:41:01 8883 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
at gcomm/src/pc.cpp:connect():162
2016-09-06 03:41:01 8883 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():208: Failed to open backend connection: -110 (Connection timed out)
2016-09-06 03:41:01 8883 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1387: Failed to open channel 'my_centos_cluster' at 'gcomm://172.16.5.5,172.16.5.6,172.16.5.3': -110 (Connection timed out)
2016-09-06 03:41:01 8883 [ERROR] WSREP: gcs connect failed: Connection timed out
2016-09-06 03:41:01 8883 [ERROR] WSREP: wsrep::connect(gcomm://172.16.5.5,172.16.5.6,172.16.5.3) failed: 7
2016-09-06 03:41:01 8883 [ERROR] Aborting
百度一番之后
……
……
解决办法如下
在pxc2和pxc3上分别执行
rm -fr /var/lib/mysql/grastate.dat
再次启动
[root@pxc2 ~]# /etc/init.d/mysql restart
Shutting down MySQL (Percona XtraDB Cluster) ERROR! MySQL (Percona XtraDB Cluster) PID file could not be found!
ERROR! MySQL (Percona XtraDB Cluster) is not running, but lock file (/var/lock/subsys/mysql) exists
Starting MySQL (Percona XtraDB Cluster)..State transfer in progress, setting sleep higher
.. SUCCESS!
[root@pxc3 ~]# /etc/init.d/mysql start
ERROR! MySQL (Percona XtraDB Cluster) is not running, but lock file (/var/lock/subsys/mysql) exists
Starting MySQL (Percona XtraDB Cluster)..State transfer in progress, setting sleep higher
.. SUCCESS!
[root@pxc2 ~]# netstat -lntup|egrep "4567|3306"
tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 11639/mysqld
tcp 0 0 :::3306 :::* LISTEN 11639/mysqld
[root@pxc3 ~]# netstat -lntup|egrep "3306|4567"
tcp 0 0 0.0.0.0:4567 0.0.0.0:* LISTEN 9830/mysqld
tcp 0 0 :::3306 :::* LISTEN 9830/mysqld
分别在pxc1、pxc2和pxc3上登录mysql检查,发现功能都正常,至此,问题解决!!