我已经通过这里的说明安装了mariadb 10.1:
https://mariadb.com/kb/en/mariadb/yum/#installing-mariadb-galera-cluster-with-yum
但是当我运行服务器:
sudo service mysql start --wsrep-new-cluster
该服务器不作为cluser运行:
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.)把这个添加到/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和firewalld才能让其他节点连接到群集。 (我知道生产使用你应该处理selinux和防火墙的规则,但在我的情况下,这是一个本地机器上的testing,所以如果你用它来正确处理这个)
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 | +------------------------------+-------------------------------------------------------------+