无法运行 mariadb 10.1 galera 集群

无法运行 mariadb 10.1 galera 集群

我已按照此处的说明安装了 mariadb 10.1:

https://mariadb.com/kb/en/mariadb/yum/#installing-mariadb-galera-cluster-with-yum

但是当我使用以下命令运行服务器时:

sudo service mysql start --wsrep-new-cluster

服务器未作为集群运行:

 MariaDB [(none)]> show status like 'wsrep%';
+--------------------------+----------------------+
| Variable_name            | Value                |
+--------------------------+----------------------+
| wsrep_cluster_conf_id    | 18446744073709551615 |
| wsrep_cluster_size       | 0                    |
| wsrep_cluster_state_uuid |                      |
| wsrep_cluster_status     | Disconnected         |
| wsrep_connected          | OFF                  |
| wsrep_local_index        | 18446744073709551615 |
| wsrep_provider_name      |                      |
| wsrep_provider_vendor    |                      |
| wsrep_provider_version   |                      |
| wsrep_ready              | ON                   |
+--------------------------+----------------------+

但是我没有接触过 my.cnf,因为说明中没有提到它。我还需要做其他事情吗?

我的 MariaDB 版本是

mysql  Ver 15.1 Distrib 10.1.9-MariaDB, for Linux (x86_64) using readline 5.1

在centos7上

答案1

我已经解决了这个问题,我正在使用 centos7,我必须:

1.) 在 /etc/my.cnf.d/server.cnf 中添加此内容

[mysqld]
bind-address=0.0.0.0

[galera]

wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
binlog_format=ROW
wsrep_cluster_address='gcomm://'
wsrep_cluster_name='galera_cluster'
wsrep_node_name='node1'

2.) 我必须禁用 selinux 和防火墙,以便让其他节点连接到集群。(我知道对于生产用途,您应该处理 selinux 和防火墙规则,但就我而言,这是在本地机器上进行的测试,因此如果您将其用于生产,请正确处理此问题)

3.)在连接节点中指定/etc/my.cnf.d/server.cnf:

[mysqld]
bind-address=0.0.0.0

[galera]

wsrep_on=ON
wsrep_provider=/usr/lib64/galera/libgalera_smm.so
binlog_format=ROW
wsrep_cluster_address='gcomm://ip_of_the_master,ip_of_other_nodes'
wsrep_cluster_name='galera_cluster'
wsrep_node_name='nodeX'

然后启动mysql服务。

现在我的集群如下所示:

MariaDB [(none)]> SHOW GLOBAL STATUS LIKE 'wsrep_%';
+------------------------------+-------------------------------------------------------------+
| Variable_name                | Value                                                       |
+------------------------------+-------------------------------------------------------------+
| wsrep_apply_oooe             | 0.000000                                                    |
| wsrep_apply_oool             | 0.000000                                                    |
| wsrep_apply_window           | 1.000000                                                    |
| wsrep_causal_reads           | 0                                                           |
| wsrep_cert_deps_distance     | 60.887500                                                   |
| wsrep_cert_index_size        | 24                                                          |
| wsrep_cert_interval          | 0.000000                                                    |
| wsrep_cluster_conf_id        | 73                                                          |
| wsrep_cluster_size           | 3                                                           |
| wsrep_cluster_state_uuid     | c44d1346-a5c3-11e5-9a68-ca1db8f95be1                        |
| wsrep_cluster_status         | Primary                                                     |
| wsrep_commit_oooe            | 0.000000                                                    |
| wsrep_commit_oool            | 0.000000                                                    |
| wsrep_commit_window          | 1.000000                                                    |
| wsrep_connected              | ON                                                          |
| wsrep_evs_delayed            |                                                             |
| wsrep_evs_evict_list         |                                                             |
| wsrep_evs_repl_latency       | 0/0/0/0/0                                                   |
| wsrep_evs_state              | OPERATIONAL                                                 |
| wsrep_flow_control_paused    | 0.000000                                                    |
| wsrep_flow_control_paused_ns | 0                                                           |
| wsrep_flow_control_recv      | 0                                                           |
| wsrep_flow_control_sent      | 0                                                           |
| wsrep_gcomm_uuid             | 3c438933-a727-11e5-b2f2-f659b1338a74                        |
| wsrep_incoming_addresses     | 100.120.88.245:3306,100.120.88.244:3306,100.120.88.246:3306 |
| wsrep_last_committed         | 400                                                         |
| wsrep_local_bf_aborts        | 0                                                           |
| wsrep_local_cached_downto    | 1                                                           |
| wsrep_local_cert_failures    | 0                                                           |
| wsrep_local_commits          | 391                                                         |
| wsrep_local_index            | 0                                                           |
| wsrep_local_recv_queue       | 0                                                           |
| wsrep_local_recv_queue_avg   | 0.071429                                                    |
| wsrep_local_recv_queue_max   | 2                                                           |
| wsrep_local_recv_queue_min   | 0                                                           |
| wsrep_local_replays          | 0                                                           |
| wsrep_local_send_queue       | 0                                                           |
| wsrep_local_send_queue_avg   | 0.000000                                                    |
| wsrep_local_send_queue_max   | 1                                                           |
| wsrep_local_send_queue_min   | 0                                                           |
| wsrep_local_state            | 4                                                           |
| wsrep_local_state_comment    | Synced                                                      |
| wsrep_local_state_uuid       | c44d1346-a5c3-11e5-9a68-ca1db8f95be1                        |
| wsrep_protocol_version       | 7                                                           |
| wsrep_provider_name          | Galera                                                      |
| wsrep_provider_vendor        | Codership Oy <[email protected]>                           |
| wsrep_provider_version       | 25.3.9(r3387)                                               |
| wsrep_ready                  | ON                                                          |
| wsrep_received               | 182                                                         |
| wsrep_received_bytes         | 17414                                                       |
| wsrep_repl_data_bytes        | 52304                                                       |
| wsrep_repl_keys              | 1183                                                        |
| wsrep_repl_keys_bytes        | 18664                                                       |
| wsrep_repl_other_bytes       | 0                                                           |
| wsrep_replicated             | 400                                                         |
| wsrep_replicated_bytes       | 96568                                                       |
| wsrep_thread_count           | 2                                                           |
+------------------------------+-------------------------------------------------------------+

相关内容