简体   繁体   English

无法启动MySQL Galera群集中的第二个节点

[英]Can't start second node in MySQL Galera cluster

All action are performed in debian 7 virtual machines. 所有操作均在debian 7虚拟机中执行。 Two nodes have installed: galera replicator, mysql galera from codership, percona-xtrabackup, netcat-openbsd (requried by percona-xtrabackup). 已安装两个节点:galera复制器,来自mysql的mysql galera,percona-xtrabackup,netcat-openbsd(由percona-xtrabackup替代)。 The third node has only galera replicator and acts as arbitrator with garbd running. 第三个节点只有galera复制器,并在garbd运行时充当仲裁器。

Config on node #1 (192.168.0.102) 在节点#1(192.168.0.102)上配置

wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=2G"
wsrep_cluster_name="clusterTest"
wsrep_cluster_address="gcomm://"
wsrep_node_name="node-1"
wsrep_node_address=192.168.0.102
wsrep_node_incoming_address=192.168.0.102
wsrep_slave_threads=16
wsrep_sst_method=xtrabackup
wsrep_sst_receive_address=192.168.0.102
wsrep_sst_auth=root:somepass

Config on node #2 (192.168.0.103) 在节点2上配置(192.168.0.103)

wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=2G"
wsrep_cluster_name="clusterTest"
wsrep_cluster_address="gcomm://192.168.0.102"
wsrep_node_name="node-2"
wsrep_node_address=192.168.0.103
wsrep_node_incoming_address=192.168.0.103
wsrep_slave_threads=16
wsrep_sst_method=xtrabackup
wsrep_sst_receive_address=192.168.0.103
wsrep_sst_auth=root:somepass
wsrep_sst_donor="node-1"

At first run only node-1 has a database for testing, let's call it testDB. 第一次运行时,只有node-1有一个用于测试的数据库,我们称之为testDB。

What I do: 我所做的:

1. node-1> service mysql start
Result: node is working, testDB is accessible from any host and the node itself.
2. node-3> garbd --address gcomm://192.168.0.102,192.168.0.103 --group "clusterTest"
Resutl: the cluster size is 2.
3. node-2> service mysql start
Result: the cluster size is 3, but the init-script reports that service start failed, however the processes are running, the sst is performed.

Also I can't access mysql running on node-2: 我也无法访问在node-2上运行的mysql:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

And from remote host: 从远程主机:

PHP Warning:  mysqli::mysqli(): (HY000/2003): Can't connect to MySQL server on '192.168.0.103' (111)

Cluster state from node-1: 节点1的群集状态:

wsrep_local_state_comment    | Donor/Desynced
wsrep_incoming_addresses     | 192.168.0.102:3306,,192.168.0.103:3306
wsrep_cluster_conf_id        | 3                                     
wsrep_cluster_size           | 3   

If I start the mysql on node-2 with wsrep_provider set to "none", the database is fully accessible from local and remote host and is equal to the database on node-1. 如果我在wsrep_provider设置为“ none”的节点2上启动mysql,则可以从本地和远程主机完全访问该数据库,并且该数据库等于节点1上的数据库。 If I start the cluster again, the situation repeats, node-2 is only visible by other nodes, cluster becomes desynced and node-2 is not accessible neither from console, nor from remote hosts. 如果我再次启动集群,情况将会重复,节点2仅对其他节点可见,集群变得不同步,并且无法从控制台或远程主机访问节点2。

Your most helpful tool when troubleshooting Galera issues will be the MySQL error logs. 解决Galera问题时,最有用的工具是MySQL错误日志。 In Debian, they are located in /var/log/syslog by default. 在Debian中,它们默认位于/ var / log / syslog中。

It appears you're using Node 1 to bootstrap your cluster. 看来您正在使用节点1引导群集。 It's critical to get your wsrep_cluster_address settings correct. 正确设置wsrep_cluster_address的设置至关重要。 The settings for both nodes should be as follows: 两个节点的设置应如下所示:

Node 1

wsrep_cluster_address=gcomm://


Node 2

wsrep_cluster_address=gcomm://192.168.0.102,192.168.0.103

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM