介绍html
在MySQL高可用架构中,目前使用比较多的是Percona的PXC,Galera以及MySQL 5.7以后的MGR等,其余的还有的MHA,今天介绍另外一个比较好用的MySQL高可用复制管理工具:Orchestrator(orch)。
mysql
Orchestrator(orch):go编写的MySQL高可用性和复制拓扑管理工具,支持复制拓扑结构的调整,自动故障转移和手动主从切换等。后端数据库用MySQL或SQLite存储元数据,并提供Web界面展现MySQL复制的拓扑关系及状态,经过Web可更改MySQL实例的复制关系和部分配置信息,同时也提供命令行和api接口,方便运维管理。相对比MHA来看最重要的是解决了管理节点的单点问题,其经过raft协议保证自己的高可用。GitHub的一部分管理也在用该工具进行管理。关于Orchestrator更详细的介绍能够看Github的介绍,大体的特色有:git
① 自动发现MySQL的复制拓扑,而且在web上展现。github
② 重构复制关系,能够在web进行拖图来进行复制关系变动。web
③ 检测主异常,并能够自动或手动恢复,经过Hooks进行自定义脚本。sql
④ 支持命令行和web界面管理复制。数据库
部署以下json
试验环境vim
mysql服务器 orchestrator & master:10.72.16.112 slave1:10.72.16.50 slave2:10.72.16.59
一、安装orchestratorsegmentfault
orchestrator-cli-3.0.11-1.x86_64.rpm安装程序须要依赖包,安装依赖包jq-1.五、oniguruma-5.9.5
而且最好在redhat 7的操做系统安装。
yum install orchestrator-3.1.2-1.x86_64.rpm jq-1.5-1.el7.x86_64.rpm oniguruma-5.9.5-3.el7.x86_64.rpm 安装完成后,目录在/usr/local/orchestrator
二、配置主机解析
[root@hchtest4 ~]# cat /etc/hosts 10.72.16.112 hchtest4 10.72.16.50 hchtest3 10.72.16.59 hchtest-elk
三、3台MySQL主从复制省略
四、orchestrator的后台管理端数据库权限配置(112上执行)
在orch后端数据库112上: CREATE DATABASE IF NOT EXISTS orchestrator; CREATE USER 'orchestrator'@'%' IDENTIFIED BY 'hch123'; GRANT ALL PRIVILEGES ON orchestrator.* TO 'root'@'%';
五、3台orch管理的数据库集群上,权限及数据库执行(3台数据库执行)
CREATE USER 'orchestrator'@'%' IDENTIFIED BY 'hch123'; GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'orchestrator'@'%'; GRANT SELECT ON mysql.slave_master_info TO 'orchestrator'@'%'; CREATE DATABASE IF NOT EXISTS meta; GRANT SELECT ON meta.* TO 'orchestrator'@'%';
六、修改配置文件
cp /usr/local/orchestrator/conf/orchestrator-sample.conf.json /etc/orchestrator.conf.json vim /etc/orchestrator.conf.json #被管理MySQL数据库的用户权限数据库帐号密码 "MySQLTopologyUser": "root", "MySQLTopologyPassword": "hch123", #orchestrator管理后台数据库帐号密码 "MySQLOrchestratorHost": "10.72.16.112", "MySQLOrchestratorPort": 3306, "MySQLOrchestratorDatabase": "orchestrator", "MySQLOrchestratorUser": "orchestrator", "MySQLOrchestratorPassword": "hch123", "DiscoverByShowSlaveHosts": false,
DiscoverByShowSlaveHosts": ture 这种状况下,必须配置report_host
$ vim /etc/my_3306.cnf
report_host=192.168.225.128 //ip为自身的ip
说明:不加report_host ,show slave hosts 不会显示host,会致使程序报错的
report_host为只读参数,必须重启才可生效
说明:
DiscoverByShowSlaveHosts": false 也能够,这样就不须要设置report_host了
七、建立命令软连接
ln -s /usr/local/orchestrator/orchestrator /usr/bin/
八、启动orchestrator
orchestrator --debug --config=/etc/orchestrator.conf.json http 查看端口 [root@orchestrator ~]# netstat -tnpl |grep :3000 tcp6 0 0 :::3000 :::* LISTEN 6084/orchestrator
八、命令行发现:
orchestrator -c discover -i 10.72.16.50 orchestrator -c discover -i 10.72.16.59 orchestrator -c clusters ----查看集群
九、访问网页
http://10.72.16.51:3000
参考
Orchestrator部署配置 - qq_26496673的博客 - CSDN博客 https://blog.csdn.net/qq_26496673/article/details/82810671
MySQL高可用复制管理工具 —— Orchestrator介绍 - jyzhou - 博客园 https://www.cnblogs.com/zhoujinyi/p/10387581.html
MySQL高可用复制管理工具 —— Orchestrator使用 - jyzhou - 博客园 https://www.cnblogs.com/zhoujinyi/p/10394389.html
orchestrator 安装?参数?VIP脚本? - wangxin3618的博客 - CSDN博客 https://blog.csdn.net/wangxin3618/article/details/97013376
orchestrator简介 - fearless11的博客 - CSDN博客 https://blog.csdn.net/fearless11/article/details/77170764
Orchestrator管理mysql复制 - 我的文章 - SegmentFault 思否 https://segmentfault.com/a/1190000017838535?utm_source=tag-newest
MySQL复制拓扑管理工具Orchestrator - 简书 https://www.jianshu.com/p/62e95a131028
MySQL高可用探索之orchestrator | Yangtze River's blog https://riverdba.github.io/2019/03/19/orchestrator/