【DB宝40】MySQL高可用管理工具Orchestrator简介及测试
文章目录
- 一、Orchestrator简介
- 二、快速搭建Orchestrator环境
- 三、添加主从环境
- 四、修改集群别名
- 五、拖动界面修改主从关系
- 六、自动failover
一、Orchestrator简介
Orchestrator是一款开源,对MySQL复制提供高可用、拓扑的可视化管理工具,采用go语言编写,它能够主动发现当前拓扑结构和主从复制状态,支持MySQL主从复制拓扑关系的调整、支持MySQL主库故障自动切换(failover)、手动主从切换(switchover)等功能。
Orchestrator后台依赖于MySQL或者SQLite存储元数据,能够提供Web界面展示MySQL集群的拓扑关系及实例状态,通过Web界面可更改MySQL实例的部分配置信息,同时也提供命令行和api接口,以便更加灵活的自动化运维管理。Orchestrator 对MySQL主库的故障切换分为自动切换和手动切换。手动切换又分为recover、force-master-failover、force-master-takeover以及graceful-master-takeover。
相比于MHA,Orchestrator更加偏重于复制拓扑关系的管理,能够实现MySQL任一复制拓扑关系的调整,并在此基础上,实现MySQL高可用。另外,Orchestrator自身也可以部署多个节点,通过raft分布式一致性协议,保证自身的高可用。
Orchestrator主要有以下几个特征:
- 自动监测数据库复制的结构及其状态
- 提供了GUI,CLI,API等接口来检查复制拓扑的状态以及做一些调整的操作
- 支持自动的master failover,当复制结构的server挂掉以后(不管手动还是自动的),能够重新形成复制的拓扑结构
- 不依赖于特定的server版本或分支(MySQL, Percona Server, MariaDB or even MaxScale binlog servers)
- 支持多种类型的拓扑结构,不管是单个的主从还是成百上千个server组成的多级复制都不在话下
- 它的GUI不只是向你report拓扑状态,还可以在Orchestrator web页面通过拖拽或者删除节点来改变复制拓扑(CLI和API也能做)
Orchestrator的GitHub地址:
https://github.com/openark/orchestrator
https://github.com/outbrain/orchestrator/wiki/Orchestrator-Manual
https://github.com/github/orchestrator/tree/master/docs
Orchestrator的所有参数:
https://github.com/github/orchestrator/blob/master/go/config/config.go
官方建议的生产配置示例:
https://github.com/github/orchestrator/blob/master/docs/configuration-sample.md
二、快速搭建Orchestrator环境
-- 拉取小麦苗的镜像
docker pull registry.cn-hangzhou.aliyuncs.com/lhrbest/lhrorchestrator:1.0-- 创建容器
docker run -d --name lhrorchestrator -h lhrorchestrator \-p 233:22 -p 3087:3389 -p 3000:3000 \--privileged=true lhrbest/lhrorchestrator:1.0 \/usr/sbin/init-- 进入容器
docker exec -it lhrorchestrator bash-- 启动后端存储MySQL库
systemctl status mysqld
MySQL用户名和密码:root/lhr-- 启动orchestrator
systemctl start orchestrator
systemctl status orchestrator-- web访问:
http://192.168.66.35:3000
用户名和密码:lhr/lhr-- 日志:
tailf /var/log/messages-- 参数文件
/usr/local/orchestrator/orchestrator.conf.json
web界面如下所示:
三、添加主从环境
把配置好的复制实例加入到orchestrator,因为orch可以自动发现整个拓扑的所有实例,所以只需要添加任意一台实例即可。
这里,我有一套1主2从的环境,拓扑图如下所示:
[root@docker35 log]# mysqlrplshow --master=root:lhr@172.72.0.2:3306 --discover-slaves-login=root:lhr --verbose
WARNING: Using a password on the command line interface can be insecure.
# master on 172.72.0.2: ... connected.
# Finding slaves for master: 172.72.0.2:3306# Replication Topology Graph
172.72.0.2:3306 (MASTER)|+--- 172.72.0.3:3306 [IO: Yes, SQL: Yes] - (SLAVE)|+--- 172.72.0.4:3306 [IO: Yes, SQL: Yes] - (SLAVE)
下面开始把这套环境添加到orchestrator中:
添加成功。
我们再添加一套双主双从的环境:
选择任意一台MySQL服务器进行Discover操作,添加完成后,刷新页面如下:
四、修改集群别名
修改完成后,刷新页面:
注意:集群别名不支持中文。
五、拖动界面修改主从关系
手动修改主从关系:
六、自动failover
要实现自动failover,需要修改2个参数:
[root@lhrorchestrator orchestrator]# more orchestrator.conf.json | grep ClusterFilters"RecoverMasterClusterFilters": ["*"],"RecoverIntermediateMasterClusterFilters": ["*"],
这2个参数表示定义哪些集群可以自动failover和recover。
自动failover之前:
宕掉主库:
[root@lhrorchestrator /]# mysql -uroot -plhr -h172.72.0.2 -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11357
Server version: 5.7.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> shutdown ;
Query OK, 0 rows affected (0.00 sec)
刷新页面:
172.72.0.2自动被剔除,新主库变为172.72.0.3。
172.72.0.4指向了新的主库172.72.0.3。
172.72.0.2已宕机,边框为黑色:
接下来启动172.72.0.2,启动完成后:
需要我们手动加入集群:
[root@docker35 log]# mysql -uroot -plhr -h172.72.0.2 -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.30-log MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show slave hosts;
Empty set (0.00 sec)mysql> show slave status;
Empty set (0.00 sec)mysql> change master to-> master_host='172.72.0.3',-> master_port=3306,-> master_user='repl',-> master_password='lhr',-> master_auto_position=1;
show slave status \G;
Query OK, 0 rows affected, 1 warning (0.02 sec)mysql>
mysql> start slave;
Query OK, 0 rows affected (0.01 sec)mysql> show slave status \G;
*************************** 1. row ***************************Slave_IO_State: Checking master versionMaster_Host: 172.72.0.3Master_User: replMaster_Port: 3306Connect_Retry: 60Master_Log_File: Read_Master_Log_Pos: 4Relay_Log_File: master-relay-bin.000001Relay_Log_Pos: 4Relay_Master_Log_File: Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 0Relay_Log_Space: 154Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 0Master_UUID: Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: bacfcde8-69dc-11eb-b240-0242ac480002:1-70574,
bc6d26f0-69dc-11eb-bfa7-0242ac480003:1-5Auto_Position: 1Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version:
1 row in set (0.00 sec)ERROR:
No query specifiedmysql>
刷新页面:
可以看到,又回到了一主2从的环境。
About Me
● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除
● 本文在个人微 信公众号(DB宝)上有同步更新
● QQ群号: 230161599 、618766405,微信群私聊
● 个人QQ号(646634621),微 信号(db_bao),注明添加缘由
● 于 2021年2月 在西安完成
● 最新修改时间:2021年2月
● 版权所有,欢迎分享本文,转载请保留出处
●小麦苗的微店: https://weidian.com/?userid=793741433
●小麦苗出版的数据库类丛书: http://blog.itpub.net/26736162/viewspace-2142121/
●小麦苗OCP、OCM、高可用、DBA学习班(Oracle、MySQL、NoSQL): http://blog.itpub.net/26736162/viewspace-2148098/
●数据库笔试面试题库及解答: https://mp.weixin.qq.com/s/Vm5PqNcDcITkOr9cQg6T7w
使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号(DB宝)及QQ群(DBA宝典)、添加小麦苗微信, 学习最实用的数据库技术。
【DB宝40】MySQL高可用管理工具Orchestrator简介及测试相关推荐
- mysql 实例名_不为人知的MySQL高可用复制管理工具——Orchestrator简介
背景 在MySQL高可用架构中,目前使用比较多的是Percona的PXC,Galera以及MySQL 5.7之后的MGR等,其他的还有的MHA,今天介绍另一个比较好用的MySQL高可用复制管理工具:O ...
- 【DB宝42】MySQL高可用架构MHA+ProxySQL实现读写分离和负载均衡
文章目录 一.MHA+ProxySQL架构 二.快速搭建MHA环境 2.1 下载MHA镜像 2.2 编辑yml文件,创建MHA相关容器 2.3 安装docker-compose软件(若已安装,可忽略) ...
- Linux——MySQL高可用-PXC架构
参考Percona官方:https://www.percona.com/software/mysql-database/percona-xtradb-cluster MySQL-PXC 一.PXC概述 ...
- mysql1.7(mysql优化,mysql-mmm软件介绍,mysql高可用集群。)
一,mysql优化. 1. 1mysql服务工作过程 mysql服务由8个功能组件组成: 1,管理工具 把软件包安装后,提供的命令. #mv /etc/my.cnf /etc/my.cnf.ba ...
- MySQL高可用方案之MHA
目录 一.简介 二.MHA特点 三.搭建MySQL MHA 1.安装MHA 2.在所有服务器上配置无密码认证 3.在manager节点上配置MHA 4. manager节点编辑配置文件,管理 mysq ...
- 死磕数据库系列(二十六):MySQL 高可用之单主、双主模型组复制配置实践
点关注公众号,回复"1024"获取2TB学习资源! 前面我们学习:MySQL 高可用之组复制(MGR)技术的相关原理知识,今天我将详细的为大家介绍 MySQL 高可用技术组复制的单 ...
- 魅族资深DBA:利用MHA构建MySQL高可用平台
龙启东 魅族资深DBA 负责MySQL.Redis.MongoDB以及自动化平台建设 .擅长MySQL高可用方案.SQL性能优化.故障诊断等. 本次分享主要包括以下几方面: 如何利用MHA 改造MHA ...
- MySQL高可用架构
MySQL学习笔记 一,高可用架构 对于一个企业来讲,设计一个高可用的架构非常重要,包括前端的高可用和后端数据库的高可用.企业业务每暂停一分钟,可能会造成大量的金钱流失,因此只有在整个架构的设计上足够 ...
- 优酷土豆资深工程师:MySQL高可用之MaxScale与MHA
讲师介绍 侯野优酷土豆资深数据库工程师 擅长Orale.MySQL故障诊断.性能调优,目前专注于MySQL的高可用技术. 曾任职于大连东软.清华紫光.触控科技等公司,服务过华夏银行.中国华能电力集团 ...
最新文章
- 直播 | Python Web开发者的破局之道
- HIve分组查询返回每组的一条记录
- Java对象类型转换
- Robocode教程2——你的第一个robo,取个好名字哦
- 【软工】第一次阅读作业
- 备库由于表无主键导致延迟
- Fiddler抓包工具入门:软件测试员必知的抓取https协议的方法
- 计算几何常用算法及numpy仿真
- Ubuntu18.04误删分区表,无法挂载U盘解决
- 《转》Babel 入门教程
- C#开源大全--汇总
- 学术蓝毕业论文答辩PPT模板
- rufus中gpt和mrb磁盘_SSD固态硬盘用GPT还是MBR分区?
- oracle免安装和安装版区别,Oracle免安装客户端
- el earch 安装
- 邮件发送超大附件,上传下载特别慢,怎么解决?
- luoguT30208 太极剑(贪心)
- 技术分享| 如何使用FFmpeg命令处理音视频
- Java-编写一个类 Book,代表图书
- kali安装水泽,进行简单换源