MySQL HA(High Availability) 数据库高可用工具Orchestrator安装

本文主要介绍如何在本地安装 MySQL HA(High 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.jsonorchestrator.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,后面有时间再介绍下在生产环境中的安装。

5.参考

orchestrator docs

猜你喜欢

转载自blog.csdn.net/lanyang123456/article/details/128757681
今日推荐