视频:《Orchestrator 管理与实战》
环境介绍
节点角色 | IP | 备注 |
mysql(master) | 192.168.3.100 | 被接管的数据库节点 |
mysql(slave) | 192.168.3.101 | 被接管的数据库从节点 |
orchestrator | 192.168.2.103 | /usr/local/orchestrator |
orchestrator_db | 192.168.2.103 | 存储orch的元数据(mysql/sqlite) |
安装Orchestrator
介质下载地址:https://github.com/openark/orchestrator/releases/tag/v3.2.6
二进制文件方式安装
sudo mkdir -p /usr/local
sudo cd /usr/local
sudo tar xzfv orchestrator-3.2.6-linux-amd64.tar.gz
RPM文件方式安装
默认安装目录:/usr/local/orchestrator
sudo rpm -i orchestrator-1.0-1.x86_64.rpm
配置后端MySQL服务器
CREATE DATABASE IF NOT EXISTS orchestrator;
CREATE USER 'orchestrator'@'127.0.0.1' IDENTIFIED BY '123456';
GRANT ALL PRIVILEGES ON `orchestrator`.* TO 'orchestrator'@'127.0.0.1';
Orchestrator
使用一个配置文件, 位于/etc/orchestrator.conf.json
或/${orchestrator软件路径}/conf/orchestrator.conf.json
或 ./orchestrator.conf.json
.
除非显式指定-config参数, 否则orchestrator会在以上位置找按顺序读取配置文件: config.Read("/etc/orchestrator.conf.json", "conf/orchestrator.conf.json", "orchestrator.conf.json")
. 会读取所有文件(无论有没有), 后面的配置文件会覆盖前面配置文件中的参数配置
根据上面提供的后端mysql的信息,编辑 orchestrator.conf.json:
...
"MySQLOrchestratorHost": "127.0.0.1",
"MySQLOrchestratorPort": 3306,
"MySQLOrchestratorDatabase": "orchestrator",
"MySQLOrchestratorUser": "orchestrator",
"MySQLOrchestratorPassword": "123456",
"DiscoverByShowSlaveHosts": false,
...
启动orchestrator
假设已经在/usr/local/orchestrator
下安装了orchestrator
:
cd /usr/local/orchestrator && ./orchestrator http
Orchestrator
将开始监听3000
端口. 将你的浏览器指向http://your.host:3000/
, 你就可以开始了.
如果您喜欢调试消息:
cd /usr/local/orchestrator && ./orchestrator --debug http
或者, 在出现错误时显示更详细的信息:
cd /usr/local/orchestrator && ./orchestrator --debug --stack http
以上在 /etc/orchestrator.conf.json
、conf/orchestrator.conf.json
、orchestrator.conf.json
中按顺序查找配置. 通常是将配置放在/etc/orchestrator.conf.json
中. 由于它包含您的 MySQL 服务器的凭据, 您可能希望限制对该文件的访问. 您可以选择为配置文件使用不同的位置, 在这种情况下执行:
cd /usr/local/orchestrator && ./orchestrator --debug --config=/path/to/config.file http
在被接管数据库上创建用户
为了使 orchestrator 能够检测到你的复制拓扑,必须在每个拓扑上创建一个账号,且所有拓扑上的账号必须是相同的(相同的用户,相同的密码)。在每个主服务器上,执行以下操作:
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
为了使orchestrator能够连接到被接管数据库,需要用户及密码写入orchestrator的配置文件 orchestrator.conf.json:
"MySQLTopologyUser": "orchestrator",
"MySQLTopologyPassword": "orch_topology_password",