设置 MariaDB Galera 集群 Ubuntu Zesty

设置 MariaDB Galera 集群 Ubuntu Zesty

我不知道如何在 Ubuntu Zesty 上初始化 MariaDB Galera 集群。我按照文档操作,但似乎缺少了一些东西。我无法启动第一个节点。

我使用标准包安装:

apt install mariadb-server

我已经在/etc/mysql/mariadb.conf.d/90-cluster.cnf

[mariadb]
bind-address = 0.0.0.0
binlog-format = ROW
innodb-autoinc-lock-mode = 2
innodb-flush-log-at-trx-commit = 0
wsrep-on = ON
wsrep-sst-method = rsync
wsrep-cluster-name = "example"
wsrep-cluster-address = "gcomm://maria01.example.com,maria02.example.com"
wsrep-node-address = "maria01"
wsrep-node-name = "maria01.example.com"

注意:我还尝试将 wsrep-cluster-address 设置为“gcomm://”

我尝试通过停止服务并启动专门的脚本来进行引导:

systemctl stop mariadb
galera_new_cluster

然后我连接到实例并检查状态:

show global variables like 'wsrep%';
+---------------------------------+-----------------------------------------+
| wsrep_osu_method                | TOI                                     |
| wsrep_auto_increment_control    | ON                                      |
| wsrep_causal_reads              | OFF                                     |
| wsrep_certify_nonpk             | ON                                      |
| wsrep_cluster_address           | gcomm://                                |
| wsrep_cluster_name              | example                                 |
| wsrep_convert_lock_to_trx       | OFF                                     |
| wsrep_data_home_dir             | /var/lib/mysql/                         |
| wsrep_dbug_option               |                                         |
| wsrep_debug                     | OFF                                     |
| wsrep_desync                    | OFF                                     |
| wsrep_dirty_reads               | OFF                                     |
| wsrep_drupal_282555_workaround  | OFF                                     |
| wsrep_forced_binlog_format      | NONE                                    |
| wsrep_gtid_domain_id            | 0                                       |
| wsrep_gtid_mode                 | OFF                                     |
| wsrep_load_data_splitting       | ON                                      |
| wsrep_log_conflicts             | OFF                                     |
| wsrep_max_ws_rows               | 0                                       |
| wsrep_max_ws_size               | 2147483647                              |
| wsrep_mysql_replication_bundle  | 0                                       |
| wsrep_node_address              | maria01                                 |
| wsrep_node_incoming_address     | AUTO                                    |
| wsrep_node_name                 | maria01.example.com                     |
| wsrep_notify_cmd                |                                         |
| wsrep_on                        | OFF                                     |
| wsrep_patch_version             | wsrep_25.16                             |
| wsrep_provider                  | none                                    |
| wsrep_provider_options          | pc.bootstrap=1                          |
| wsrep_recover                   | OFF                                     |
| wsrep_replicate_myisam          | OFF                                     |
| wsrep_restart_slave             | OFF                                     |
| wsrep_retry_autocommit          | 1                                       |
| wsrep_slave_fk_checks           | ON                                      |
| wsrep_slave_uk_checks           | OFF                                     |
| wsrep_slave_threads             | 1                                       |
| wsrep_sst_auth                  |                                         |
| wsrep_sst_donor                 |                                         |
| wsrep_sst_donor_rejects_queries | OFF                                     |
| wsrep_sst_method                | rsync                                   |
| wsrep_sst_receive_address       | AUTO                                    |
| wsrep_start_position            | 00000000-0000-0000-0000-000000000000:-1 |
| wsrep_sync_wait                 | 0                                       |
+---------------------------------+-----------------------------------------+

show status like 'wsrep%';
+--------------------------+----------------------+
| wsrep_cluster_conf_id    | 18446744073709551615 |
| wsrep_cluster_size       | 0                    |
| wsrep_cluster_state_uuid |                      |
| wsrep_cluster_status     | Disconnected         |
| wsrep_connected          | OFF                  |
| wsrep_local_bf_aborts    | 0                    |
| wsrep_local_index        | 18446744073709551615 |
| wsrep_provider_name      |                      |
| wsrep_provider_vendor    |                      |
| wsrep_provider_version   |                      |
| wsrep_ready              | ON                   |
| wsrep_thread_count       | 0                    |
+--------------------------+----------------------+

特别注意,它是0,但根据文档wsrep_cluster_size运行后它应该是1 。galera_new_cluster

Maria 日志没有太多内容,但看起来集群已经初始化:

systemd[1]: Starting MariaDB database server...
sh[4083]: 2017-05-03 22:11:40 139734663651904 [Note] /usr/sbin/mysqld (mysqld 10.1.22-MariaDB-) starting as process 4203 ...
sh[4083]: WSREP: Recovered position 00000000-0000-0000-0000-000000000000:-1
mysqld[4238]: 2017-05-03 22:11:44 140634874606144 [Note] /usr/sbin/mysqld (mysqld 10.1.22-MariaDB-) starting as process 4238 ...
systemd[1]: Started MariaDB database server.

答案1

您的集群配置似乎缺少一些东西:

  1. wsrep_provider应设置为 Galera wsrep 库的路径
  2. wsrep_on应设置为“ON”。

看起来您实际上需要修改大部分配置以使用下划线而不是破折号。状态输出中的关键问题是没有,wsrep_provider并且wsrep_on设置为关闭。您可以在MariaDB 页面

相关内容