1. 程式人生 > 其它 >MySQL-高可用架構-ORCH

MySQL-高可用架構-ORCH

ORCH元件管理MySQL複製高可用架構

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

使用

附錄

參考文件