MariaDB Galera。为什么复制不起作用?

MariaDB Galera。为什么复制不起作用?

我尝试了很多配置 MariaDB Galera 的手册,但所有情况下复制都不起作用。我在 10.5 版本上遇到了困难

今天我尝试了 10.3 版本,唯一出现的问题是wsrep_ready | ON在 10.5 版本中,情况也不是这样。

操作系统:CentOS 8 Stream

MariaDB的:

# mysql -uroot -e 'SELECT version();'
+---------------------+
| version()           |
+---------------------+
| 10.3.36-MariaDB-log |
+---------------------+

节点配置

节点1:

[mysqld]
max_connections=350
log-bin=/var/log/mysql/mysql-bin
log-bin-index=/var/log/mysql/mysql-bin.index
binlog-format = 'ROW'
default-storage-engine=innodb
#
innodb_autoinc_lock_mode=2
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
innodb_doublewrite=1
#
innodb_flush_log_at_trx_commit=0
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.84.200,10.10.84.201,10.10.84.202"
wsrep_on=ON
# Galera Cluster Configuration
wsrep_cluster_name="cluster"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="10.10.84.200"
wsrep_node_name="os-controller-01"

节点2:

[mysqld]
max_connections=350
log-bin=/var/log/mysql/mysql-bin
log-bin-index=/var/log/mysql/mysql-bin.index
binlog-format = 'ROW'
default-storage-engine=innodb
#
innodb_autoinc_lock_mode=2
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
innodb_doublewrite=1
#
innodb_flush_log_at_trx_commit=0
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.84.200,10.10.84.201,10.10.84.202"
wsrep_on=ON
# Galera Cluster Configuration
wsrep_cluster_name="cluster"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="10.10.84.201"
wsrep_node_name="os-controller-02"

节点3:

[mysqld]
max_connections=350
log-bin=/var/log/mysql/mysql-bin
log-bin-index=/var/log/mysql/mysql-bin.index
binlog-format = 'ROW'
default-storage-engine=innodb
#
innodb_autoinc_lock_mode=2
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
innodb_doublewrite=1
#
innodb_flush_log_at_trx_commit=0
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_address="gcomm://10.10.84.200,10.10.84.201,10.10.84.202"
wsrep_on=ON
# Galera Cluster Configuration
wsrep_cluster_name="cluster"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="10.10.84.202"
wsrep_node_name="os-controller-03"

集群状态:

MariaDB [(none)]> show status like 'wsrep_%';
+-------------------------------+----------------------+
| Variable_name                 | Value                |
+-------------------------------+----------------------+
| wsrep_applier_thread_count    | 0                    |
| 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_rollbacker_thread_count | 0                    |
| wsrep_thread_count            | 0                    |
+-------------------------------+----------------------+
14 rows in set (0.001 sec)

防火墙已禁用。

您能帮忙设置复制吗?

答案1

版本 10.4 已运行。

+----------------------------+--------------------------------------+
| Variable_name              | Value                                |
+----------------------------+--------------------------------------+
| wsrep_cluster_weight       | 3                                    |
| wsrep_cluster_capabilities |                                      |
| wsrep_cluster_conf_id      | 3                                    |
| wsrep_cluster_size         | 3                                    |
| wsrep_cluster_state_uuid   | 292d8c8e-3260-11ed-8a78-4f7603e75f47 |
| wsrep_cluster_status       | Primary                              |
+----------------------------+--------------------------------------+

我的配置

节点1:

/etc/my.cnf

[mysqld]
port = 3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections = 10000
wait_timeout = 600
symbolic-links=0
key_buffer_size = 64M
max_heap_table_size = 64M
tmp_table_size = 64M
innodb_buffer_pool_size = 4096M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 16M
thread_concurrency = 8
max_allowed_packet = 64M
wait_timeout=2880000
interactive_timeout = 2880000
default-storage-engine = innodb
innodb_autoinc_lock_mode = 2
collation-server = utf8_general_ci
character_set_server=utf8
skip-name-resolve
!includedir /etc/my.cnf.d/
[mariadb]
log-error=/var/log/mariadb/mariadb.log

/etc/my.cnf.d/galera.cnf

[galera]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=10.10.84.200
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=openstack
wsrep_cluster_address="gcomm://10.10.84.200:4567,10.10.84.201:4567,10.10.84.202:4567"
wsrep_node_name=os-controller-01
wsrep_node_address=10.10.84.200
wsrep_sst_method=rsync
wsrep_causal_reads=ON
wsrep_slave_threads=4
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=

节点2:

/etc/my.cnf

[mysqld]
port = 3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections = 10000
wait_timeout = 600
symbolic-links=0
key_buffer_size = 64M
max_heap_table_size = 64M
tmp_table_size = 64M
innodb_buffer_pool_size = 4096M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 16M
thread_concurrency = 8
max_allowed_packet = 64M
wait_timeout=2880000
interactive_timeout = 2880000
default-storage-engine = innodb
innodb_autoinc_lock_mode = 2
collation-server = utf8_general_ci
character_set_server=utf8
skip-name-resolve
!includedir /etc/my.cnf.d/
[mariadb]
log-error=/var/log/mariadb/mariadb.log

/etc/my.cnf.d/galera.cnf

[galera]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=10.10.84.201
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=openstack
wsrep_cluster_address="gcomm://10.10.84.200:4567,10.10.84.201:4567,10.10.84.202:4567"
wsrep_node_name=os-controller-02
wsrep_node_address=10.10.84.201
wsrep_sst_method=rsync
wsrep_causal_reads=ON
wsrep_slave_threads=4
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=

节点3:

/etc/my.cnf

[mysqld]
port = 3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections = 10000
wait_timeout = 600
symbolic-links=0
key_buffer_size = 64M
max_heap_table_size = 64M
tmp_table_size = 64M
innodb_buffer_pool_size = 4096M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 16M
thread_concurrency = 8
max_allowed_packet = 64M
wait_timeout=2880000
interactive_timeout = 2880000
default-storage-engine = innodb
innodb_autoinc_lock_mode = 2
collation-server = utf8_general_ci
character_set_server=utf8
skip-name-resolve
!includedir /etc/my.cnf.d/
[mariadb]
log-error=/var/log/mariadb/mariadb.log

/etc/my.cnf.d/galera.cnf

[galera]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=10.10.84.202
wsrep_on=ON
wsrep_provider=/usr/lib64/galera-4/libgalera_smm.so
wsrep_cluster_name=openstack
wsrep_cluster_address="gcomm://10.10.84.200:4567,10.10.84.201:4567,10.10.84.202:4567"
wsrep_node_name=os-controller-03
wsrep_node_address=10.10.84.202
wsrep_sst_method=rsync
wsrep_causal_reads=ON
wsrep_slave_threads=4
wsrep_certify_nonPK=1
wsrep_max_ws_rows=131072
wsrep_max_ws_size=1073741824
wsrep_debug=0
wsrep_convert_LOCK_to_trx=0
wsrep_retry_autocommit=1
wsrep_auto_increment_control=1
wsrep_drupal_282555_workaround=0
wsrep_causal_reads=0
wsrep_notify_cmd=

相关内容