温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

pxc三个节点全部异常和正常关闭的启动顺序是怎样的

发布时间:2021-10-08 16:44:57 来源:亿速云 阅读:271 作者:柒染 栏目:MySQL数据库

这篇文章给大家介绍pxc三个节点全部异常和正常关闭的启动顺序是怎样的,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

mysql 5.7.27 pxc 三个节点全部异常和正常关闭的启动顺序:

1、正常关闭所有节点的时候因为不能生成gvwstate.dat,所以一定要保证第一个启动的是包含最新数据的节点!

mysqld_safe --defaults-file=/etc/my.cnf --wsrep-recover来查看最新的节点!

2、Server version: 5.7.27-30-57-log 这个版本中,如下修改后!剩余一个节点也是可以提供服务的!

#wsrep_cluster_address = gcomm://10.9.21.179:4567,10.9.21.178:4567

wsrep_cluster_address = gcomm://

3.关于wsrep_cluster_address :

你启动数据库的时候,需要保证该参数中的一半以上的节点能连通,才能启动,否则会报错,所以如果有鉴证节点的话,最好把鉴证也加上!

wsrep_cluster_address = gcomm://10.9.21.179:4567,10.9.21.178:4567

报错如下所示:

2020-03-23T04:55:26.861788Z 0 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1514: Failed to open channel 'LIUWENHE_CLUSTER' at 'gcomm://10.9.21.179:4567,10.9.21.178:4567': -110 (Connection timed out)

如果两个数据节点+一个鉴证节点,如果正常关闭了这两个数据节点,那么再启动的时候一定要去看看到底哪个节点是数据最新的,因为都是正常关闭的,所有没有生成gvwstate.dat文件,自然不能自动恢复(5.7.27-30-57)

1确定最新的节点:否则将会有数据丢失!

(如果你不是选择的最新的启动了,那么当你尝试启动另一个数据节点(数据多的节点)的时候

会报错说这个节点应用了更多的事务,而启动失败,具体如下:

2020-03-23T03:44:19.126386Z 0 [ERROR] WSREP: gcs/src/gcs_group.cpp:group_post_state_exchange():353: Reversing history: 12202 -> 12200, this member has applied 2 more events than the primary component.Data loss is possible. Aborting.

2020-03-23T03:44:19.126413Z 0 [Note] WSREP: /usr/sbin/mysqld: Terminated.)

[root@beijing-fuli-hadoop-01 ~]# mysqld_safe --defaults-file=/etc/my.cnf --wsrep-recover

2020-03-23T03:27:52.074550Z mysqld_safe Logging to '/data/logs/mysql/mysql_error.log'.

2020-03-23T03:27:52.078135Z mysqld_safe Logging to '/data/logs/mysql/mysql_error.log'.

2020-03-23T03:27:52.120280Z mysqld_safe Starting mysqld daemon with databases from /data/mysqldata

2020-03-23T03:27:52.134598Z mysqld_safe Skipping wsrep-recover for efca7e03-f55c-11e9-a230-5645b597da6b:12202 pair

2020-03-23T03:27:52.137112Z mysqld_safe Assigning efca7e03-f55c-11e9-a230-5645b597da6b:12202 to wsrep_start_position

2020-03-23T03:27:55.022957Z mysqld_safe mysqld from pid file /data/mysqldata/mysql.pid ended

2 修改/data/mysqldata/grastate.dat中的safe_to_bootstrap: 0改为1

# GALERA saved state

version: 2.1

uuid: efca7e03-f55c-11e9-a230-5645b597da6b

seqno: 12202

safe_to_bootstrap: 1

如果不改错误日志中会有提示:

2020-03-22T06:28:43.728598Z 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 .

3 如果不能保证一半以上的节点是可连通的,那么需要修改参数文件配置,改为空的,具体如下,这样修改之后一个节点也是可以提供服务的,记住只需要修改第一个启动的节点的即可!

vi /etc/my.cnf

#wsrep_cluster_address = gcomm://10.9.21.179:4567,10.9.21.178:4567

wsrep_cluster_address = gcomm://

否则会报错,无法open channel 10.9.21.178:4567,因为他是关闭的,但是如果你的参数设置的是

wsrep_cluster_address = gcomm://10.9.21.179:4567,10.9.21.178:4567,10.9.21.114:4567,这样把鉴证节点也加上的话,如果鉴证节点服务是开启的网络也没问题,那就可以启动了,就不需要修改了

具体报错:

2020-03-23T04:55:26.861711Z 0 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view (pc.wait_prim_timeout): 110 (Connection timed out)

at gcomm/src/pc.cpp:connect():159

2020-03-23T04:55:26.861730Z 0 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():209: Failed to open backend connection: -110 (Connection timed out)

2020-03-23T04:55:26.861788Z 0 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1514: Failed to open channel 'LIUWENHE_CLUSTER' at 'gcomm://10.9.21.179:4567,10.9.21.178:4567': -110 (Connection timed out)

4 启动即可!

/etc/init.d/mysql start

关于pxc三个节点全部异常和正常关闭的启动顺序是怎样的就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

pxc
AI