MYSQL5.7下搭建Replication-Manager
环境说明
在主机1,主机2,主机3上安装MySQL服务端和客户端。
主机1 |
主机2 |
主机3 |
|
操作系统 |
CentOS7.4 |
CentOS7.4 |
CentOS7.4 |
主机名 |
mydb1 |
mydb2 |
mydb3 |
IP |
192.168.1.101 |
192.168.1.102 |
192.168.1.103 |
角色 |
主 |
从 |
从 |
ProxySQL Replication-Manager |
|||
数据库软件版本 |
mysql5.7.22 |
mysql5.7.22 |
mysql5.7.22 |
MySQL配置文件 |
/app/mysqldata/3306/ my.cnf |
/app/mysqldata/3306/ my.cnf |
/app/mysqldata/3306/ my.cnf |
Replication-Manager配置文件 |
/etc/replication-manager/config.toml |
||
安装包 |
proxysql-1.4.13-1.1.el7.x86_64.rpm replication-manager-osc |
||
一. 主从复制配置
MySQL5.7-GTID-mysqldump,xtrabackup搭建.txt
大规模插入数据.txt
安装ProxySQL
做成快照Replication-Manager
二.开始配置Replication-Manager
安装
vi /etc/yum.repos.d/signal18.repo
\加入一下内容
[signal18]
name=Signal18 repositories
baseurl=http://repo.signal18.io/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
#yum install replication-manager-osc
Loaded plugins: fastestmirror
signal18 ....
Installed:
replication-manager-osc.x86_64 1532599358:2.0.1_6_g0ff0d-1
Complete!
配置
vi /etc/replication-manager/config.toml
[db3306]
title = "db3306"
db-servers-hosts = "192.168.1.101:3306,192.168.1.102:3306,192.168.1.103:3306"
db-servers-prefered-master = "192.168.1.101:3306"
db-servers-credential = "dba_user:msds007"
replication-credential = "dba_user:msds007"
failover-mode = "manual"
proxysql=true
proxysql-server="192.168.1.101"
proxysql-port=6033
proxysql-admin-port=6032
proxysql-writer-hostgroup=1
proxysql-reader-hostgroup=2
proxysql-user="myuser"
proxysql-password="myuser"
proxysql-bootstrap=false
[Default]
monitoring-datadir = "/data/replication-manager"
monitoring-sharedir = "/data/share_replication-manager"
log-level=7
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"
启动
# /etc/init.d/replication-manager start
# netstat -nltp
在浏览器中打开:http://192.168.1.101:10001/
点击Switchover可以进行切换
能看到ProxySQL的统计