Orchestrator安装部署
orchestrator部署:
orchestrator-3.0.11.tar.gz ----服务包
orchestrator-cli-3.0.11-1.x86_64.rpm ----二进制命令
所有主机节点安装mysql5.7数据库
首先实现mysql的主从关系
orchestrator=192.168.41.128
master=192.168.41.129
slave1=192.168.41.130
slave2=192.168.41.131
修改hosts记录
vim /etc/hosts(所有主机添加)
192.168.41.128 orchestrator.example.com
192.168.41.129 master.example.com
192.168.41.130 slave1.example.com
192.168.41.131 slave2.example.com
orchestrator.example.com主机修改
修改mysql5.7初始密码
vim /etc/my.cnf
[mysqld]
skip-grant-tables ----添加一行
shell>mysql
mysql>use mysql
mysql>update user set authentication_string=PASSWORD('123') where user='root';
mysql>exit
重启mysql数据库
vim /etc/my.cnf
[mysqld]
#skip-grant-tables ----注释掉
新修改密码即刻过期,需要重新设置密码
mysql> set PASSWORD='123456';
[root@orchestrator ~]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 93
Server version: 5.7.22 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>create database orchestrator; -----创建orchestrator软件使用数据库
mysql> create user orchestrator@'localhost' identified by '123'; -----创建授权用户
mysql> create user orchestrator@'orchestrator.example.com' identified by '123';
mysql> GRANT ALL ON orchestrator.* TO orchestrator@'localhost' ; ----授权
mysql> GRANT ALL ON orchestrator.* TO orchestrator@'orchestrator.example.com';
mysql>exit
安装orchestrator软件
rpm -ivh orchestrator-cli-3.0.11-1.x86_64.rpm ----获取二进制命令
tar xf orchestrator-3.0.11.tar.gz -C /usr/local
[root@orchestrator ~]# cp /usr/local/orchestrator-3.0.11/conf/orchestrator-sample.conf.json /etc/orchestrator.conf.json
[root@orchestrator ~]# vim /etc/orchestrator.conf.json
2 "Debug": true, ----开启测试信息
3 "EnableSyslog": false, ----关闭日志(测试环境之后可以关闭测试信息,开启系统日志)
4 "ListenAddress": ":3000", ----监听地址与端口
5 "MySQLTopologyUser": "orchestrator", ----后台数据库连接用户(在主库数据库中创建)
6 "MySQLTopologyPassword": "123456", ----后台用户密码
13 "MySQLOrchestratorHost": "192.168.41.128", ----软件监听主机地址
14 "MySQLOrchestratorPort": 3306, ----端口
15 "MySQLOrchestratorDatabase": "orchestrator", ----所属库
16 "MySQLOrchestratorUser": "orchestrator", ----登录用户
17 "MySQLOrchestratorPassword": "123", ----密码
master.example.com主机 设置:
vim /etc/my.cnf
[mysqld]
server_id=1
log-bin=binlog
创建同步账号:
[root@master ~]#
[root@master ~]# mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.7.22-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create user slave@'192.168.41.%' identified by '123'; ----创建主从同步用户
mysql> GRANT ALL ON *.* TO slave@'192.168.41.130' ;
mysql> create user orchestrator@'192.168.41.128' identified by '123456'; ----创建orchestrator软件授权用户
mysql> grant all on *.* to orchestrator@'192.168.41.128';
导出数据库
mysqldump -uroot -p123456 --all-databases --master-data=2 > /root/mysql_all.sql
scp /root@/mysql_all.sql root@192.168.41.130:/root
slave1.example.com 主机配置
vim /etc/my.cnf
[mysqld]
server_id=2
mysql -uroot -p123456 < /root/mysql_all.sql
mysql -uroot -p123456
mysql>change master to \
>MASTER_HOST='192.168.41.129',
>MASTER_USER='slave',
>MASTER_PASSWORD='123',
>MASTER_LOG_FILE='binlog_00001',
>MASTER_LOG_POS=772;
mysql> start slave;
mysql> show slave status\G;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.41.129
Master_User: slave
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: binlog.000001
Read_Master_Log_Pos: 2461
Relay_Log_File: slave1-relay-bin.000004
Relay_Log_Pos: 317
Relay_Master_Log_File: binlog.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
实现主从同步之后,在orchestrator主机上启动服务,并且发现后台数据库
[root@orchestrator ~]# orchestrator http &
[root@orchestrator ~]# netstat -tnpl |grep :300
tcp6 0 0 :::3000 :::* LISTEN 6084/orchestrator
命令行发现:
orchestrator -c discover -i 192.168.41.129
orchestrator -c discover -i 192.168.41.130
orchestrator -c clusters ----查看集群
或者图形界面发现
Cluster ---> Discover ----> host:port
登录测试:
http://192.168.41.128:3000
实际操作中文档较少,实际需求是能够监控mysql数据库的GTID同步库与表,但是貌似没有实现,不知哪位大神可以指点指点