前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >MySQL高可用工具—Orchestrator初识

MySQL高可用工具—Orchestrator初识

作者头像
MySQL轻松学
发布2019-10-20 18:30:43
1.4K0
发布2019-10-20 18:30:43
举报
文章被收录于专栏:MYSQL轻松学MYSQL轻松学

Orchestrator是一款开源的MySQL复制拓扑管理工具,采用go语言编写,支持MySQL主从复制拓扑关系的调整、支持MySQL主库故障自动切换、手动主从切换等功能。

Orchestrator后台依赖于MySQL或者SQLite存储元数据,能够提供Web界面展示MySQL集群的拓扑关系及实例状态,通过Web界面可更改MySQL实例的部分配置信息,同时也提供命令行和api接口,以便更加灵活的自动化运维管理。

相比于MHA,Orchestrator更加偏重于复制拓扑关系的管理,能够实现MySQL任一复制拓扑关系的调整,并在此基础上,实现MySQL高可用,另外Orchestrator自身可以部署多个节点,通过raft分布式一致性协议,保证自身的高可用。

环境说明

后台管理节点

被监测MYSQL集群

IP

11.11.10.10

11.21.193.85:335811.42.212.23:335811.42.210.106:3358

操作系统

CentOS 7.2

CentOS 7.2

Orchestrator

orchestrator-3.1.2-1.x86_64.rpmorchestrator-cli-3.1.2-1.x86_64.rpmorchestrator-client-3.1.2-1.x86_64.rpm

MYSQL‍

mysql5.7

mysql5.6以上,开启GTID复制

后台管理节点 CentOS Linux release 7.2以上,不然可能会出现缺少依赖包。

安装MySQL数据库,在启动Orchestrator程序的时候,会自动在数据库里创建orchestrator数据库,保存orchestrator的一些数据信息。

下载安装包

代码语言:javascript
复制
https://github.com/github/orchestrator/releaseswget https://github.com/github/orchestrator/releases/download/v3.1.2/orchestrator-3.1.2-1.x86_64.rpm         -服务包wget https://github.com/github/orchestrator/releases/download/v3.1.2/orchestrator-cli-3.1.2-1.x86_64.rpm     -二进制命令wget https://github.com/github/orchestrator/releases/download/v3.1.2/orchestrator-client-3.1.2-1.x86_64.rpm  -命令行工具

安装

代码语言:javascript
复制
[root@localhost ~]# rpm -ivh orchestrator-*Preparing...                          ################################# [100%]Updating / installing...   1:orchestrator-cli-1:3.1.2-1       ################################# [100%]Preparing...                          ################################# [100%]Updating / installing...   1:orchestrator-1:3.1.2-1           ################################# [100%]

安装后会在/usr/local下生成orchestrator目录,包含以下文件和目录:

orchestrator-sample-sqlite.conf.json

采用SQLite库模板

orchestrator-sample.conf.json

默认的配置模板

orchestrator

应用程序

resources

orchestrator相关的文件:client、web、伪GTID等相关文件

创建后台管理节点的库和用户

代码语言:javascript
复制
CREATE DATABASE IF NOT EXISTS orchestrator;GRANT ALL PRIVILEGES ON `orchestrator`.* TO 'orc_server_user'@'%' IDENTIFIED BY 'server_passwd';

被监测的MYSQL授权

代码语言:javascript
复制
GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'orc_client_user'@'%' IDENTIFIED BY 'client_passwd';

修改配置文件

cp orchestrator-sample.conf.json orchestrator.conf.json

代码语言:javascript
复制
  "Debug": false,                               #设置Debug方式  "EnableSyslog": false,                        #是否把日志输出到系统日志里  "ListenAddress": ":3000",                     #web端口  "MySQLTopologyUser": "orc_client_user",       #被监测的MYSQL实例用户  "MySQLTopologyPassword": "client_passwd",     #被监测的MYSQL实例密码  "MySQLOrchestratorHost": "11.11.10.10",       #后台管理主机  "MySQLOrchestratorPort": 3306,                #后台管理库端口  "MySQLOrchestratorDatabase": "orchestrator",  #后台管理库名  "MySQLOrchestratorUser": "orc_server_user",   #后台管理库用户  "MySQLOrchestratorPassword": "server_passwd", #后台管理库密码  "MySQLHostnameResolveMethod": "@@report_host",#解析主机名方式  "DetectClusterAliasQuery": "SELECT concat(@@report_host,':',@@port)", #集群别名

官方参考配置:https://github.com/github/orchestrator/blob/master/docs/configuration-sample.md

配置参数解释:MySQL高可用工具—Orchestrator配置说明

启动

代码语言:javascript
复制
/usr/local/orchestrator/orchestrator -config=/usr/local/orchestrator/orchestrator.conf.json http &

查看端口

代码语言:javascript
复制
[root@localhost orchestrator]# netstat  -nltp|grep 3000tcp6       0      0 :::3000                 :::*                    LISTEN      574969/orchestrator

命令行注册集群

代码语言:javascript
复制
orchestrator -config=/usr/local/orchestrator/orchestrator.conf.json -c discover -i 192.168.1.2:3306

命令行查看集群

代码语言:javascript
复制
orchestrator -c clusters

通过web访问

http://11.11.10.10:3000

页面中discover

查看集群架构

拖动更改架构

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-10-17,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 MYSQL轻松学 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档