简体   繁体   English

无法将节点添加到galera mariadb 10.1群集

[英]Can't add nodes to galera mariadb 10.1 cluster

I'm trying to setup a galera MariaDB 10.1 cluster on Centos 7. Here is my master configuration: 我正在尝试在Centos 7上设置galera MariaDB 10.1集群。这是我的主配置:

[mysqld]

wsrep_cluster_address="gcomm://10.47.246.45,10.47.246.9"
wsrep_node_address="10.47.246.45"
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

and when I type 当我键入

SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';

I get this output 我得到这个输出

+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 1     |
+--------------------+-------+

Here is the configuration on the node I'm trying to add 这是我要添加的节点上的配置

[mysqld] 的[mysqld]

wsrep_cluster_address="gcomm://10.47.246.45,10.47.246.9"
wsrep_node_address="10.47.246.9"
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

and mysql service starts without any errors using: 和mysql服务启动没有任何错误,使用:

service mysql start --wsrep-new-cluster

and this is the output from 这是来自的输出

SHOW GLOBAL STATUS LIKE 'wsrep_cluster_size';

I get his output 我得到他的输出

+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| wsrep_cluster_size | 0     |
+--------------------+-------+

Any idea what could be wrong with my configuration? 知道我的配置有什么问题吗?

First of all I want to suggest to use minimum three nodes in Galera cluster to prevent split braining there. 首先,我想建议在Galera群集中至少使用三个节点,以防止在那里出现头脑混乱的情况。

The correct configuration related to Galera cluster settings for the first host is (the others should have the same template): 与第一台主机的Galera群集设置相关的正确配置是(其他主机应具有相同的模板):

[mysqld]
log_error               = /var/log/mysql/mysql-error.log
default_storage_engine  = InnoDB
binlog_format           = ROW
wsrep_on                = ON
wsrep_provider          = /usr/lib64/galera/libgalera_smm.so
wsrep_cluster_address   = "gcomm://<node1_ip>,<node2_ip>,<node3_ip>"
wsrep_cluster_name      = cluster
wsrep_node_name         = <node1_name>
wsrep_node_address      = <node1_ip>
innodb_autoinc_lock_mod = 2
wsrep_sst_method        = rsync

To start Galera cluster just do the following on the first node: 要启动Galera集群,只需在第一个节点上执行以下操作:

# galera_new_cluster

Check that your cluster has been created: 检查您的集群是否已创建:

# mysql -e "show status like '%wsrep_cluster%'"
+--------------------------+--------------------------------------+
| Variable_name            | Value                                |
+--------------------------+--------------------------------------+
| wsrep_cluster_conf_id    | 1234                                 |
| wsrep_cluster_size       | 1                                    |
| wsrep_cluster_state_uuid | 020e3d69-2b31-11e7-9723-4b205d7b7e0c |
| wsrep_cluster_status     | Primary                              |
+--------------------------+--------------------------------------+

And start MariaDB on the other hosts: 并在其他主机上启动MariaDB

systemctl start mariadb

Nodes should join your Galera cluster. 节点应加入您的Galera群集。

If it is not working still, follow logs in /var/log/mysql/mysql-error.log 如果仍然无法正常工作,请遵循/var/log/mysql/mysql-error.log日志

I had the same problem, each of ny nodes seemed to start their own little 1-node cluster. 我遇到了同样的问题,每个ny节点似乎都启动了自己的小型1节点集群。 Solution: Look in /usr/lib/systemd/system/mariadb.service about line 30: 解决方案:在/usr/lib/systemd/system/mariadb.service中查找有关第30行的信息:

ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION ExecStart = / usr / sbin / mysqld $ MYSQLD_OPTS $ _WSREP_NEW_CLUSTER $ _WSREP_START_POSITION

Except for node 10.47.246.45, on all others remove $ WSREP_NEW_CLUSTER and save the configuration. 除节点10.47.246.45以外,在所有其他节点上除去$ WSREP_NEW_CLUSTER并保存配置。 Make sure you start with galera_new_cluster on 10.47.246.45 and once it is running start the other nodes one by one with systemctl start mysql (or service mysql start) 确保从10.47.246.45上的galera_new_cluster开始,一旦运行,则使用systemctl逐个启动其他节点(或服务mysql启动)

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

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