MySQL HA(High Availability) 数据库高可用工具Orchestrator安装
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
目录
本文主要介绍如何在本地安装 MySQL HAHigh Availability 数据库高可用工具Orchestrator 。
1.下载安装包
下载地址
接着解压安装包
例如安装orchestrator 到目录 /usr/local/orchestrator下
mkdir -p /usr/local
cd /usr/local
tar xzfv orchestrator-1.0.tar.gz
2.安装 backend MySQL server
orchestrator 使用backend db存储一些元信息包括需要探测的实例、集群名等。
本文中MySQL server 作为backend。
首先安装MySQL server可参考官方文档。
安装完成后接着创建访问backend 的用户。
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
使用的配置文件在 /etc/orchestrator.conf.json
或者是可执行文件的目录下的 conf/orchestrator.conf.json
或 orchestrator.conf.json
安装包中自带 orchestrator.conf.json.sample
位于路径 /usr/local/orchestrator/orchestrator-sample.conf.json
可以参考这个文件自定义配置文件内容。 也可以参考官网链接。
修改配置内容如下
...
"MySQLOrchestratorHost": "127.0.0.1",
"MySQLOrchestratorPort": 3306,
"MySQLOrchestratorDatabase": "orchestrator",
"MySQLOrchestratorUser": "orchestrator",
"MySQLOrchestratorPassword": "orch_backend_password",
...
3.在MySQL实例上授权
Orchestrator 会探测MySQL实例的复制拓扑需要一些权限:
CREATE USER 'orchestrator'@'orch_host' IDENTIFIED BY 'orch_topology_password';
GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'orchestrator'@'orch_host';
GRANT SELECT ON mysql.slave_master_info TO 'orchestrator'@'orch_host';
GRANT SELECT ON ndbinfo.processes TO 'orchestrator'@'orch_host'; -- Only for NDB Cluster
根据需要将orch_host
替换为相应的机器例如%
, 10.%
xx.xx.xx.xx
等。
并在 orchestrator.conf.json
文件中修改
"MySQLTopologyUser": "orchestrator",
"MySQLTopologyPassword": "orch_topology_password",
4.启动orchestrator 服务
如果 orchestrator安装目录在/usr/local/orchestrator
执行
cd /usr/local/orchestrator && ./orchestrator http
orchestrator 服务启动后监听3000端口。
在浏览器中打开页面http://your.host:3000/
如果是本地启动服务可以使用 http://127.0.0.1:3000/
如果需要调试信息可以执行:
cd /usr/local/orchestrator && ./orchestrator --debug http
更多的debug信息可以执行:
cd /usr/local/orchestrator && ./orchestrator --debug --stack http
上面的启动方式参数中没有指定配置文件会在以下位置寻找配置文件
/etc/orchestrator.conf.json
, conf/orchestrator.conf.json
, orchestrator.conf.json
。
也可以指定具体的配置文件
cd /usr/local/orchestrator && ./orchestrator --debug --config=/path/to/config.file http
如果是基于本地代码调试可以执行
go run go/cmd/orchestrator/main.go http
以上本文主要介绍了如何在本地安装和使用Orchestrator后面有时间再介绍下在生产环境中的安装。