时间:2021-07-01 10:21:17 帮助过:16人阅读
# cp /usr/local/mariadb/support-files/wsrep.cnf /etc/my.cnf.d/
在/etc/my.cnf里面添加一行
!includedir /etc/my.cnf.d/
编辑wsrep文件
[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=192.168.10.43
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/local/mariadb/lib/galera/libgalera_smm.so
wsrep_provider_options="gcache.name = /data/galera/galera.cache; gcache.size=1G; gcache.page_size=1G; gcache.recover = yes"
# Galera Cluster Configuration
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://192.168.10.43,192.168.10.44,192.168.10.45"
#wsrep_cluster_address="gcomm://"
wsrep_sst_auth=galera:000000
# Galera Synchronization Configuration
wsrep_sst_method=xtrabackup-v2
# Galera Node Configuration
wsrep_node_address="192.168.10.43"
wsrep_node_name="node1"
wsrep_slave_threads=8
# service mysqld stop
# mysqld --wsrep-new-cluster
# service mysqld start --wsrep_new_cluster 或者
# service mysqld start --galera_new_cluster
搭建galera cluster的时候设置sst为xtrabackup,启动node1报错。
[ERROR] WSREP: It
may not be safe to bootstrap the cluster from this node. It was not the
last one to leave the cluster and may not contain all the updates. To
force cluster bootstrap with this node, edit the grastate.dat file
manually and set safe_to_bootstrap to 1 .
解决方式:
grastate.dat file of the node you intend to use as the first node.
需要把该文件删除 重新启动即可。
解决方法:
1.安装插件yum -y install socat
2.检查用户galera是否可在本机登陆
出现节点脱离集群,原因是多节点同时对同一记录发送更新导致集群节点脱落,如果会发生这种情况那么是否需要读写分离,最后wsrep_slave_tereads制线程数量根据个人品行核心 做出决定。
MariaDB Galera Cluster(mariadb10.1.22)部署
标签:存储 firewall 并且 systemctl ati commit bootstrap adb 定义