MariaDB gcomm 后端连接失败 110

MariaDB gcomm backend connection failed 110

我正在尝试在 debian 8 jessie 下使用 MariaDB Galera 10.1。

我已经安装了所有必要的组件并进行了配置,但我无法正常工作。

节点构建为VPS。

节点1的配置:

[mysqld]

# Cluster node configurations
wsrep_cluster_address="gcomm://172.16.0.102,172.16.0.112"
wsrep_node_address="172.16.0.102"
wsrep_node_name='n1' 
wsrep_cluster_name='cluster'
innodb_buffer_pool_size=400M
# Mandatory settings to enable Galera
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
default-storage-engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0
bind-address=0.0.0.0
# Galera synchronisation configuration
wsrep_sst_method=rsync

节点2的配置:

[mysqld]

# Cluster node configurations
wsrep_cluster_address="gcomm://172.16.0.102,172.16.0.112"
wsrep_node_address="172.16.0.112"
wsrep_node_name='n2' 
wsrep_cluster_name='cluster'
innodb_buffer_pool_size=400M
# Mandatory settings to enable Galera
wsrep_provider=/usr/lib/galera/libgalera_smm.so
binlog_format=ROW
default-storage-engine=InnoDB
innodb_autoinc_lock_mode=2
innodb_doublewrite=1
query_cache_size=0
bind-address=0.0.0.0
# Galera synchronisation configuration
wsrep_sst_method=rsync

当我尝试在节点 1 运行 上执行 bootstrap 命令时

service mysql bootstrap

它因错误而失败

May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28  139843152635840 [ERROR] WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 (Connection timed out)
May 13 15:59:28 test mysqld[2397]: at gcomm/src/pc.cpp:connect():162
May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28 139843152635840 [ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():208: Failed to open backend connection: -110 (Connection timed out) 
May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28 139843152635840 [ERROR] WSREP: gcs/src/gcs.cpp:gcs_open():1379: Failed to open channel 'cluster' at 'gcomm://172.16.0.102,172.16.0.112': -110 (Connection timed out)
May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28 139843152635840 [ERROR] WSREP: gcs connect failed: Connection timed out
May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28 139843152635840 [ERROR] WSREP: wsrep::connect(gcomm://172.16.0.102,172.16.0.112) failed: 7
May 13 15:59:28 test mysqld[2397]: 2016-05-13 15:59:28 139843152635840 [ERROR] Aborting

我使用的网络配置是私有的:

2x 安装有 ProxmoxVE 4.0 的专用服务器,服务器在 vRack 网络中,在 VPS 上配置为:

node1: 172.16.0.102 //节点1在服务器1上

node2: 172.16.0.112 //节点2在服务器2上

他们能够在专用网络上相互 ping 通。

我找到了解决方案和确切的问题。

问题出在启动集群节点的过程中。需要通过 MariaDB 安装中包含的脚本启动 galera_new_cluster 什么 bootstrap 新集群,之后一切正常。

希望这对其他人在debian下通过配置有所帮助。

从 MariaDB 10.1.8 开始,systemd 是新的 init,它影响了 Galera 在基于 RPM 和 Debian 的 Linux 发行版上的引导方式(在我的例子中 Ubuntu 16.04)。在以前的版本中,您会使用 service mysql start --wsrep-new-clusterservice mysqld bootstrap 之类的东西,但它不再起作用,因为它失败了:

[ERROR] WSREP: gcs/src/gcs_core.cpp:gcs_core_open():208: Failed to open backend connection: -110 (Connection timed out)

解决这个问题运行:

galera_new_cluster

请注意,您只需要在 'first' 服务器上 运行 此脚本

要测试它是否是 运行ning,请输入 mysql 和 mysql -u [your mysql user] -p,然后输入 运行

SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';

您应该会看到如下内容:

+--------------+
| cluster size |
+--------------+
| 1            |
+--------------+

以防对任何人有用,这是我的 my.conf (MariaDB 10.1.16)

[galera]
# Mandatory settings
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://[first ip],[second ip]"
binlog_format=row
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2

此处有更多详细信息:

MariaDB systemd and galera_new_cluster

Galera Cluster System Variables

我有这个错误,但在我的情况下 galera_new_cluster 不起作用。

通过编辑 /var/lib/mysql/grastate.dat 文件并将 safe_to_bootstrap 更改为 1 解决了问题。

完成后,galera_new_cluster 有效。

在我的例子中,一切都配置正确,这个错误是由阻止 MariaDB 端口的防火墙引起的。我通过在所有服务器上允许它们来修复它:

ufw allow 3306,4567,4568,4444/tcp;
ufw allow 4567/udp;

我知道这个话题已经很老了。我试图安装一个 kubernetes mariadb 集群并且 运行 遇到了那个问题。我必须将 grastate.dat 中的信息从一个节点复制到下一个节点。我必须用 cat grastate.dat 显示一个表单节点 1,并将所有内容复制到没有 uuid 的下一个节点。完成后文件如下所示:

# GALERA saved state
version: 2.1
uuid:    
seqno:   -1
safe_to_bootstrap: 1

然后保存并删除容器。重新启动后,它将使用该文件中的详细信息并将正常启动。