搭建MariaDB Galera 同步复制

本文详细介绍了如何搭建MariaDB Galera的同步复制数据库集群,涉及三台Linux服务器的配置,包括wsrep.cnf文件的修改和节点启动步骤。通过检查集群状态,确保复制的完整性和健康性,为实现高可用性奠定了基础。
摘要由CSDN通过智能技术生成

搭建同步复制的数据库集群,使用MariaDB Galera 且至少需要预先搭建三台Linux服务器。
其中在上一篇博客中有一步是需要修改wsrep.cnf这个文件中的三个参数,其中

wsrep_cluster_address="gcomm://192.168.131.145

其中那个IP地址表示的是相对于本台Linux所表示的节点的上一个服务器节点的IP地址。如果本台Linux服务器是第一个节点,那么所填写的就是本台Linux的IP

例如我搭建了三台Linux:Ip分别为
节点信息
其中第一节点的此处填写的是本机IP,第二节点填写的是第一节点的IP,第三节点填写的是第二节点的IP以此类推。
wsrep.cnf文件内容如下所示(加粗为修改内容)

[root@localhost ~]# vi /etc/my.cnf.d/wsrep.cnf
# This file contains wsrep-related mysqld options. It should be included
# in the main MySQL configuration file.
#
# Options that need to be customized:
#  - wsrep_provider
#  - wsrep_cluster_address
#  - wsrep_sst_auth
# The rest of defaults should work out of the box.

##
## mysqld options _MANDATORY_ for correct opration of the cluster
##
[mysqld]

# (This must be substituted by wsrep_format)
binlog_format=ROW

# Currently only InnoDB storage engine is supported
default-storage-engine=innodb

# to avoid issues with 'bulk mode inserts' using autoinc
innodb_autoinc_lock_mode=2

# Override bind-address
# In some systems bind-address defaults to 127.0.0.1, and with mysqldump SST
# it will have (most likely) disastrous consequences on donor node
bind-address=0.0.0.0

##
## WSREP options
##

# Enable wsrep
wsrep_on=1

# Full path to wsrep provider library or 'none'
wsrep_provider=/usr/lib64/galera/libgalera_smm.so // 修改部分

# Provider specific configuration options
#wsrep_provider_options=

# Logical cluster name. Should be the same for all nodes.
wsrep_cluster_name="my_wsrep_cluster"

# Group communication system handle
wsrep_cluster_address="gcomm://192.168.131.145"// 修改部分
/wsrep_sst_auth
## WSREP State Transfer options
##

# State Snapshot Transfer method
wsrep_sst_method=rsync

# Address which donor should send State Snapshot to.
# Should be the address of THIS node. DON'T SET IT TO DONOR ADDRESS!!!
# (SST method dependent. Defaults to the first IP of the first interface)
#wsrep_sst_receive_address=

# SST authentication string. This will be used to send SST to joining nodes.
# Depends on SST method. For mysqldump method it is root:<root password>
wsrep_sst_auth=sst:123456 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

踏雪须眉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值