所有操作都在debian 7虚拟机中执行。安装了两个节点:galera replicator,来自codership的mysql galera,percona-xtrabackup,netcat-openbsd(由percona-xtrabackup提供)。第三个节点只有galera replicator,并作为autobd运行的仲裁者。
在节点#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
在节点#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"
首次运行时,只有node-1有一个用于测试的数据库,我们称之为testDB。
我的所作所为:
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.
此外,我无法访问在node-2上运行的mysql:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)
来自远程主持人:
PHP Warning: mysqli::mysqli(): (HY000/2003): Can't connect to MySQL server on '192.168.0.103' (111)
来自node-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
如果我在node-2上启动mysql并将wsrep_provider设置为“none”,则数据库可以从本地和远程主机完全访问,并且等于node-1上的数据库。如果我再次启动集群,情况会重复出现,node-2只能被其他节点看到,集群变得无法访问,并且无法从控制台或远程主机访问node-2。
答案 0 :(得分:0)
解决Galera问题时最有用的工具是MySQL错误日志。在Debian中,它们默认位于/ var / log / syslog中。
您似乎正在使用节点1来引导群集。让wsrep_cluster_address设置正确至关重要。两个节点的设置应如下所示:
Node 1
wsrep_cluster_address=gcomm://
Node 2
wsrep_cluster_address=gcomm://192.168.0.102,192.168.0.103