主机名 |
IP/Port |
ROLE |
OS Version |
MySQL Version |
GTID Mode |
Binlog Format |
Lixora |
192.168.1.99/3306 |
master |
CentOS 7.1 |
5.7.24 |
on |
row |
Lixora-slave |
192.168.1.38/3306 |
slave |
CentOS 7.1 |
5.7.24 |
on |
row |
RP-monitor |
192.168.1.38 |
Monitor |
CentOS 7.1 |
|
|
|
安装好主备库数据库软件和初始化数据库环境;
#主库参数配置:
log-bin = mysql_master
server-id = 8801
binlog-format = row
log-slave-updates = true
enforce-gtid-consistency = true
gtid-mode = on
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
skip_name_resolve = 0
#备库参数配置:
log-bin = mysql_slave
server-id = 8802 # server id 不能相同
binlog-format = row
log-slave-updates = true
enforce-gtid-consistency = true
gtid-mode = on
sync_binlog = 1
innodb_flush_log_at_trx_commit = 1
skip_name_resolve = 0
重启主库备库,参数生效;
主库创建复制用户创建:
grant replication slave, REPLICATION CLIENT on *.* to repl@'%' identified by '123‘;
#备份主库数据到从库通过远程方式
mysqldump -uroot -pmsandbox -h 192.168.1.99 -P 5724 > /tmp/full.sql
mysqldump --all-databases --single-transaction --triggers --routines --events \
-h 192.168.1.99 -P 5724 --user=root --password=mysql >/tmp/alldb.sql
--执行change master
CHANGE MASTER TO MASTER_HOST='192.168.1.99',MASTER_USER='repl', MASTER_PASSWORD='123', MASTER_PORT=5724, MASTER_AUTO_POSITION = 1;
#检查slave 复制状态
show slave status \G;
##slave 端启动复制进程
start slave;
Package |
Flavor |
Description |
replication-manager-min |
Minimal |
Offers essential features for the most basic usage. |
replication-manager-osc |
Open Source |
Offers all features excepting provisioning (recommended version). |
replication-manager-tst |
Test |
Offers OSC features and extra features for testing like local service bootstrap, benchmarking... |
replication-manager-pro |
Provisioning |
Offers commercial, ready to go cluster provisioning solution. |
replication-manager-arb |
Arbitrator |
Offers arbitration for replication-manager clustering. |
下载地址:
http://repo.signal18.io/centos/
##yum安装方式:
1. 设置yum源
# vi /etc/yum.repos.d/signal18.repo
[signal18]
name=Signal18 repositories
baseurl=http://repo.signal18.io/centos/2.1/$releasever/$basearch/
gpgcheck=0
enabled=1
2. master 安装 yum install replication-manager-osc
yum install replication-manager-osc
##rpm 手动安装方式:
rpm -ivh replication-manager-tst-2.1.1_99_g8f175-1.x86_64.rpm
配置文件配置:
[root@lixora replication-manager]# pwd
/etc/replication-manager
[root@lixora replication-manager]# cat config.toml
[Cluster01]
title = "Cluster01"
db-servers-hosts = "192.168.1.99:5724,192.168.1.38:5724"
db-servers-prefered-master = "192.168.1.99:5724"
db-servers-credential = "repl:123"
db-servers-connect-timeout = 1
replication-credential = "repl:123"
failover-mode = "automatic"
[Default]
monitoring-datadir = "/data/replication-manager"
monitoring-sharedir = "/data/share_replication-manager"
log-level=1
log-file = "/var/log/replication-manager.log"
replication-multi-master = false
replication-multi-tier-slave = false
failover-readonly-state = true
http-server = true
http-bind-address = "0.0.0.0"
http-port = "10001"
log-sql-in-monitoring=truettp-root = "/usr/share/replication-manager/dashboard"
#启动RP manager:
/etc/init.d/replication-manager start
#设置开机启动:
systemctl enable replication-manager
#主从同步复制监控管理界面:
http://192.168.1.38:10001/