mariadb galera-节点关闭时发生错误ERROR 1047 WSREP尚未为应用程序使用准备节点 [英] mariadb galera - Error when a node shutdown ERROR 1047 WSREP has not yet prepared node for application use

查看:1400
本文介绍了mariadb galera-节点关闭时发生错误ERROR 1047 WSREP尚未为应用程序使用准备节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在2台CentO 6.6服务器上安装了2个Mariadb Galera节点(mariadb-galera-10.0.27-linux-x86_64.tar.gz).

I installed 2 Mariadb Galera nodes (mariadb-galera-10.0.27-linux-x86_64.tar.gz) on 2 CentOs 6.6 servers.

安装后,我使用参数--wsrep-new-cluster启动node1,然后不使用该参数启动node2. 它们工作正常,数据在2个节点之间成功同步.

After installed, I start node1 with parameter --wsrep-new-cluster, then start node2 without this parameter. They work fine, data is synchronized successfully between 2 nodes.

但是,当我关闭node1时. Node2仍在运行,但是当我尝试访问数据库时.它显示此错误:

But, when I shutdown node1. Node2 still running, but when I try to access database. It show this error:

use testdb;
ERROR 1047 (08S01): WSREP has not yet prepared node for application use 

在这种情况下会发生什么? 这是我在2个NODES(只是IP地址不同)上的配置

What's happen in this case? Here is my configuration on 2 NODES (Just different IP address)

[galera] 
wsrep_on=ON
wsrep_cluster_name='mysql-cluster'
wsrep_provider='/home/mariadb/mariadb-galera/lib/galera/libgalera_smm.so'
wsrep_provider_options="gcache.size=1G"
wsrep_cluster_address="gcomm://10.211.26.116:4567?

pc.wait_prim=no"
wsrep_sst_method=rsync
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
wsrep_node_address=10.211.26.117:4567
wsrep_node_name='db2'

推荐答案

两个节点的集群

两个节点群集中,单节点故障会导致另一个节点停止工作.

In a two-node cluster, a single-node failure causes the other to stop working.

情况

您有一个仅由两个节点组成的集群.节点之一不友好地离开群集.也就是说,它不是通过init或systemd关闭,而是崩溃或遭受网络连接损失.剩下的节点将无法运行.在第三方(例如人工操作员或另一个节点)提供一些附加信息之前,这种情况一直保持不变.

You have a cluster composed of only two nodes. One of the nodes leaves the cluster ungracefully. That is, instead of being shut down through init or systemd, it crashes or suffers a loss of network connectivity. The node that remains becomes nonoperational. It remains so until some additional information is provided by a third party, such as a human operator or another node.

如果一个节点在另一个节点不合时宜地离开群集后仍保持运行,则存在两个节点中的每个节点都将自己视为主要组件的风险.为了防止这种情况,该节点将无法运行.

If the node remained operational after the other left the cluster ungracefully, there would be the risk that each of the two nodes will think itself as being the Primary Component. To prevent this, the node becomes nonoperational.

解决方案

有两种解决方案可供您使用:

  • 您可以使用pc.boostrap wsrep Provider选项引导尚存的节点以形成新的主组件.为此,请登录数据库客户端并运行以下命令:

SET GLOBAL wsrep_provider_options ='pc.bootstrap = YES';

SET GLOBAL wsrep_provider_options='pc.bootstrap=YES';

这会将尚存的节点作为新的主组件进行引导.当另一个节点重新联机或恢复与此节点的网络连接时,它将启动状态转移并赶上该节点.

This bootstraps the surviving node as a new Primary Component. When the other node comes back online or regains network connectivity with this node, it will initiate a state transfer and catch up with this node.

  • 如果希望节点继续运行,则可以使用pc.ignore_sb wsrep Provider选项.为此,请登录数据库客户端并运行以下命令:

SET GLOBAL wsrep_provider_options ='pc.ignore_sb = TRUE';

SET GLOBAL wsrep_provider_options='pc.ignore_sb=TRUE';

该节点将继续处理更新,并且即使怀疑有裂脑情况也将继续这样做.

The node resumes processing updates and it will continue to do so, even in the event that it suspects a split-brain situation.

注意警告:由于上述存在裂脑情况的风险,因此在多主设备设置中启用pc.ignore_sb是危险的.但是,它确实简化了主从集群中的操作(特别是在您仅使用两个节点的情况下).

Note Warning: Enabling pc.ignore_sb is dangerous in a multi-master setup, due to the aforementioned risk for split-brain situations. However, it does simplify things in master-slave clusters, (especially in cases where you only use two nodes).

除了上面提供的解决方案之外,您还可以使用 Galera仲裁器完全避免这种情况. Galera仲裁器在仲裁计算中用作奇数节点.这意味着,如果在两节点群集中的一个节点上启用Galera Arbitrator,则即使另一个节点发生故障或失去网络连接,该节点仍是主要组件.

In addition to the solutions provided above, you can avoid the situation entirely using Galera Arbitrator. Galera Arbitrator functions as an odd node in quorum calculations. Meaning that, if you enable Galera Arbitrator on one node in a two-node cluster, that node remains the Primary Component, even if the other node fails or loses network connectivity.

http://galeracluster.com/documentation-webpages/twonode.html

这篇关于mariadb galera-节点关闭时发生错误ERROR 1047 WSREP尚未为应用程序使用准备节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆