Orchestrator(orch)
簡介
orchestrator 是 go編寫的MySQL高可用性和復制拓撲管理工具,支持復制拓撲結構的調整,自動故障轉移和手動主從切換等功能,並提供命令行訪問、HTTP API 和 Web 界面。后端數據庫用MySQL或SQLite存儲元數據,orch作為獨立的組件用於管理MySQL或SQLite數據庫復制環境的場景。
支持的功能
Discovery(自動發現)
自動發現MySQL的復制拓撲,並且在web上展示
Refactoring(重構)
可以在web進行拖圖來進行復制關系的變更
Recovery(恢復)
檢測主異常,並可以自動或手動恢復,通過Hooks進行自定義腳本
部署
orch 是用主機名進行管理維護工作。
環境規划
監控目標 MySQL一主兩從復制架構(可新建或現存環境),使用mysql作為orch的元數據庫
| IP | 主機名稱 | 端口 | 組件 |
|---|---|---|---|
| orch 后端數據庫 | |||
| 192.168.10.181 | db01 | 3306 | orchestrator |
| 192.168.10.182 | db02 | 3306 | orchestrator |
| 192.168.10.183 | db03 | 3306 | orchestrator |
| 監控目標數據庫 | |||
| 192.168.10.181 | db01 | 3308 | MySQL |
| 192.168.10.182 | db02 | 3308 | MySQL |
| 192.168.10.183 | db03 | 3308 | MySQL |
下載軟件
wget https://github.com/openark/orchestrator/releases/download/v3.2.6/orchestrator-3.2.6-linux-amd64.tar.gz
依賴
使用 MySQL 作為后端元信息庫時
- 安裝MySQL數據庫
使用 SQLite 作為后端元信息庫時
- 無
安裝
二進制(tarball)
GitHub中僅提供linux環境的tarball包
tar -xf orchestrator-3.2.6-linux-amd64.tar.gz -C /ups/app/
配置環境變量
expport PATH=/ups/app/orchestrator-3.2.6/bin:$PATH
rpm包
rpm -i orchestrator-3.2.6.x86_64.rpm
配置
配置后端元信息數據庫
-- 元數據庫MySQL和orchestrator在同一台機器,否則需要將127.1替換orchestrator所在機器ip
CREATE DATABASE IF NOT EXISTS orchestrator;
CREATE USER 'orchestrator'@'127.0.0.1' IDENTIFIED BY 'orch_backend_password';
GRANT ALL PRIVILEGES ON `orchestrator`.* TO 'orchestrator'@'127.0.0.1';
授權訪問權限(監控目標數據庫執行)
給orchestrator用戶授權訪問監控目標數據庫權限
CREATE USER 'orchestrator'@'orch_hostname' IDENTIFIED BY 'orch_topology_password';
GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'orchestrator'@'orch_hostname';
GRANT SELECT ON mysql.slave_master_info TO 'orchestrator'@'orch_hostname';
GRANT SELECT ON ndbinfo.processes TO 'orchestrator'@'orch_hostname'; -- Only for NDB Cluster
GRANT SELECT ON meta.* TO 'orchestrator'@'orch_hostname'; --自定義meta庫
Orchestrator配置文件(/etc/orchestrator.conf.json)
修改下面配置項
"MySQLOrchestratorHost": "127.0.0.1",
"MySQLOrchestratorPort": 3306,
"MySQLOrchestratorDatabase": "orchestrator",
"MySQLOrchestratorUser": "orchestrator",
"MySQLOrchestratorPassword": "orch_backend_password",
"MySQLTopologyUser": "orchestrator",
"MySQLTopologyPassword": "orch_topology_password",
啟動orchestator服務
./orchestrator --debug --config=/etc/orchestrator.conf.json http
