搭建MariaDB Galera 同步复制

搭建同步复制的数据库集群,使用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 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Re: 《Galera 高可用 MySQL 集群》 (Percona Xtradb Cluster)PXC v5.7 + Haproxy + Keepalived========================================================# Galera Cluster 如何解决问题 我们知道 Galera Cluster 是 MySQL封装了具有高一致性,支持多点写入的同步通信模块Galera而做的,它是建立在MySQL同步基础之上的,使用 Galera Cluster时,应用程序可以直接读、写某个节点的最新数据,并且可以在不影响应用程序读写的情况下,下线某个节点,因为支持多点写入,使得 Failover 变得非常简单。 目前Galera Cluster具备的功能包括如下几个方面:    1) 多主架构:真正的多点读写的集群,在任何时候读写数据,都是最新的。    2) 同步复制:集群不同节点之间数据同步,没有延迟,在数据库挂掉之后,数据不会丢失。    3) 并发复制:从节点在APPLY数据时,支持并行执行,有更好的性能表现。    4) 故障切换:在出现数据库故障时,因为支持多点写入,切的非常容易。    5) 热插拔  :在服务期间,如果数据库挂了,只要监控程序发现的够快,不可服务时间就会非常少。在节点故障期间,节点本身对集群的影响非常小。    6) 自动节点克隆:在新增节点,或者停机维护时,增量数据或者基础数据不需要人工手动备份提供, Galera Cluster会自动拉取在线节点数据,最终集群会变为一致。    7) 对应用透明:集群的维护,对应用程序是透明的,几乎感觉不到。以上几点,足以说明Galera Cluster是一个既稳健,又在数据一致性、完整性及高性能方面有出色表现的高可用解决方案

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

踏雪须眉

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

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

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

打赏作者

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

抵扣说明:

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

余额充值