强行关机之后,Percona XtraDB Cluster集群无法启动

栏目: 数据库 · 发布时间: 6年前

内容简介:版权声明:本文为Buddy Yuan原创文章,转载请注明出处。原文地址:事情是这样的,忙着下班,就匆匆忙忙的暴力的把安装的三台PXC集群虚拟机关闭了。回家在打开的时候,怎么也开不了。直接运行启动服务的命令是报错的。通过报错的提示去查看相关的日志

版权声明:本文为Buddy Yuan原创文章,转载请注明出处。原文地址: 强行关机之后,Percona XtraDB Cluster集群无法启动

事情是这样的,忙着下班,就匆匆忙忙的暴力的把安装的三台PXC集群虚拟机关闭了。回家在打开的时候,怎么也开不了。直接运行启动服务的命令是报错的。

[root@10 mysqld]# systemctl start [email protected]
Job for [email protected] failed because the control process exited with error code. See "systemctl status [email protected]" and "journalctl -xe" for details.

通过报错的提示去查看相关的日志

[root@10 mysqld]# systemctl status [email protected][email protected] - Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap
Loaded: loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 二 2019-07-02 20:57:54 CST; 2min 1s ago
Process: 4896 ExecStopPost=/usr/bin/mysql-systemd stop-post (code=exited, status=0/SUCCESS)
Process: 4867 ExecStop=/usr/bin/mysql-systemd stop (code=exited, status=2)
Process: 4296 ExecStartPost=/usr/bin/mysql-systemd start-post $MAINPID (code=exited, status=1/FAILURE)
Process: 4295 ExecStart=/usr/bin/mysqld_safe --basedir=/usr ${EXTRA_ARGS} (code=exited, status=1/FAILURE)
Process: 4255 ExecStartPre=/usr/bin/mysql-systemd start-pre (code=exited, status=0/SUCCESS)
Main PID: 4295 (code=exited, status=1/FAILURE)

7月 02 20:57:54 10.0.2.15 mysql-systemd[4296]: ERROR! mysqld_safe with PID 4295 has already exited: FAILURE
7月 02 20:57:54 10.0.2.15 systemd[1]: [email protected]: control process exited, code=exited status=1
7月 02 20:57:54 10.0.2.15 mysql-systemd[4867]: WARNING: mysql pid file /var/run/mysqld/mysqld.pid empty or not readable
7月 02 20:57:54 10.0.2.15 mysql-systemd[4867]: ERROR! mysql already dead
7月 02 20:57:54 10.0.2.15 systemd[1]: [email protected]: control process exited, code=exited status=2
7月 02 20:57:54 10.0.2.15 mysql-systemd[4896]: WARNING: mysql pid file /var/run/mysqld/mysqld.pid empty or not readable
7月 02 20:57:54 10.0.2.15 mysql-systemd[4896]: WARNING: mysql may be already dead
7月 02 20:57:54 10.0.2.15 systemd[1]: Failed to start Percona XtraDB Cluster with config /etc/sysconfig/mysql.bootstrap.
7月 02 20:57:54 10.0.2.15 systemd[1]: Unit [email protected] entered failed state.
7月 02 20:57:54 10.0.2.15 systemd[1]: [email protected] failed.
[root@10 mysqld]# systemctl start [email protected]
Job for [email protected] failed because the control process exited with error code. See "systemctl status [email protected]" and "journalctl -xe" for details.

这些错误信息看不出什么东西来。于是我进一步检查了 MySQL 的error日志。通过查看error日志发现一些信息。

2019-07-02T13:00:21.399956Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-07-02T13:00:21.400952Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-29-57-log) starting as process 7045 ...
2019-07-02T13:00:21.402588Z 0 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=10-bin' to avoid this problem.
2019-07-02T13:00:21.402718Z 0 [Note] WSREP: Setting wsrep_ready to false
2019-07-02T13:00:21.402729Z 0 [Note] WSREP: No pre-stored wsrep-start position found. Skipping position initialization.
2019-07-02T13:00:21.402732Z 0 [Note] WSREP: wsrep_load(): loading provider library '/usr/lib64/galera3/libgalera_smm.so'
2019-07-02T13:00:21.404735Z 0 [Note] WSREP: wsrep_load(): Galera 3.37(rff05089) by Codership Oy <[email protected]> loaded successfully.
2019-07-02T13:00:21.404791Z 0 [Note] WSREP: CRC-32C: using hardware acceleration.
2019-07-02T13:00:21.405060Z 0 [Note] WSREP: Found saved state: 428f9095-9980-11e9-b8b6-1322440f5dbe:14, safe_to_bootstrap: 0
2019-07-02T13:00:21.406406Z 0 [Note] WSREP: Passing config to GCS: base_dir = /var/lib/mysql/; base_host = 192.168.56.161; base_port = 4567; cert.log_conflicts = no; cert.optimistic_pa = yes; debug = no; evs.auto_evict = 0; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.join_retrans_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 10; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.user_send_window = 4; evs.view_forget_timeout = PT24H; gcache.dir = /var/lib/mysql/; gcache.freeze_purge_at_seqno = -1; gcache.keep_pages_count = 0; gcache.keep_pages_size = 0; gcache.mem_size = 0; gcache.name = /var/lib/mysql//galera.cache; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1; gcs.fc_limit = 100; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; gcs.recv_q_hard_limit = 9223372036854775807; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; gmcast.segment = 0; gmcast.version = 0; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT30S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 9; socket.checksum = 2; socket.recv_buf_size = 212992;
2019-07-02T13:00:21.413402Z 0 [Note] WSREP: GCache history reset: 428f9095-9980-11e9-b8b6-1322440f5dbe:0 -> 428f9095-9980-11e9-b8b6-1322440f5dbe:14
2019-07-02T13:00:21.414049Z 0 [Note] WSREP: Assign initial position for certification: 14, protocol version: -1
2019-07-02T13:00:21.414070Z 0 [Note] WSREP: Preparing to initiate SST/IST
2019-07-02T13:00:21.414072Z 0 [Note] WSREP: Starting replication
2019-07-02T13:00:21.414081Z 0 [Note] WSREP: Setting initial position to 428f9095-9980-11e9-b8b6-1322440f5dbe:14
2019-07-02T13:00:21.414085Z 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 .
2019-07-02T13:00:21.414088Z 0 [ERROR] WSREP: Provider/Node (gcomm://192.168.56.161,192.168.56.162,192.168.56.163) failed to establish connection with cluster (reason: 7)
2019-07-02T13:00:21.414093Z 0 [ERROR] Aborting

2019-07-02T13:00:21.414096Z 0 [Note] Giving 0 client threads a chance to die gracefully
2019-07-02T13:00:21.414100Z 0 [Note] WSREP: Waiting for active wsrep applier to exit
2019-07-02T13:00:21.414104Z 0 [Note] WSREP: Service disconnected.
2019-07-02T13:00:21.414105Z 0 [Note] WSREP: Waiting to close threads......
2019-07-02T13:00:26.414590Z 0 [Note] WSREP: Some threads may fail to exit.
2019-07-02T13:00:26.414701Z 0 [Note] Binlog end
2019-07-02T13:00:26.414959Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

这里主要是这个地方启动出现了error。这段话翻译过来意思就是:从这个节点引导集群可能不安全。它不是最后一个离开集群的,可能不包含所有更新。要强制使用此节点进行群集引导,请手动编辑grastate.dat文件,并将safe_to_bootstrap参数设置为1。所以这里我想可以尝试使用最后一个离开集群的来引导集群。当然咱们也可以修改这个文件,把这个文件的safe_to_bootstrap修改成1,但是还是不推荐这么干啊。

[root@10 /]# vi /var/lib/mysql/grastate.dat
# GALERA saved state
version: 2.1
uuid: 428f9095-9980-11e9-b8b6-1322440f5dbe
seqno: 14
safe_to_bootstrap: 0

通过对比三个节点的这个文件,发现节点3的这个文件的值为1。于是使用节点3来引导集群,顺利引导成功。

[root@10 ~]# systemctl start [email protected]

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Java核心技术·卷1:基础知识(原书第9版)

Java核心技术·卷1:基础知识(原书第9版)

(美)Cay S. Horstmann、(美)Gary Cornell / 周立新、陈波、叶乃文、邝劲筠、杜永萍 / 机械工业出版社 / 2013-11-1 / 119.00

Java领域最有影响力和价值的著作之一,拥有20多年教学与研究经验的资深Java技术专家撰写(获Jolt大奖),与《Java编程思想》齐名,10余年全球畅销不衰,广受好评。第9版根据JavaSE7全面更新,同时修正了第8版中的不足,系统全面讲解Java语言的核心概念、语法、重要特性和开发方法,包含大量案例,实践性强。 《Java核心技术·卷1:基础知识》共14章。第1章概述了Java语言与其......一起来看看 《Java核心技术·卷1:基础知识(原书第9版)》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

URL 编码/解码
URL 编码/解码

URL 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具