MySQL high availability replication management tool - Orchestrator use

Introduction to Orchestrator

Orchestrator (orch) : MySQL high availability and replication topology management tool written in go, supports adjustment of replication topology, automatic failover and manual master-slave switching, etc. The back-end database uses MySQL or SQLite to store metadata, and provides a web interface to display the topological relationship and status of MySQL replication. The replication relationship and partial configuration information of the MySQL instance can be changed through the Web. At the same time, a command line and api interface are provided to facilitate operation and maintenance manage. Compared with MHA, the most important thing is to solve the single-point problem of the management node, which guarantees its high availability through the raft protocol. Part of GitHub's management is also managed with this tool. For a more detailed introduction to Orchestrator, please refer to Github's introduction. The general features are:

① Automatically discover the replication topology of MySQL and display it on the web.

② To reconstruct the replication relationship, you can drag the image on the web to change the replication relationship.

③ Detect the main abnormality, and can recover automatically or manually, and customize the script through Hooks.

④ Support command line and web interface to manage replication.

Orchestrator installation

  1. Orchestrator download address
    https://github.com/openark/orchestrator/releases
    I downloaded orchestrator-3.2.6-1.x86_64.rpm here
    insert image description here
  2. After downloading, put it in the directory customized by the server, and then execute the following command
$ yum -y install jq
$ rpm ivh orchestrator-3.2.3-1.x86_64.rpm
准备中...                          ################################# [100%]
正在升级/安装...
   1:orchestrator-1:3.2.3-1           ################################# [100%]
......
$ rpm -ql orchestrator
/etc/systemd/system/orchestrator.service
/usr/local/orchestrator/orchestrator
/usr/local/orchestrator/orchestrator-sample-sqlite.conf.json
/usr/local/orchestrator/orchestrator-sample.conf.json
/usr/local/orchestrator/resources/bin/orchestrator-client
.....

After the installation is complete, the corresponding directory is:

/usr/local/orchestrator
insert image description here
orchestrator: application
*.json: default configuration template
resources: orchestrator-related files: client, web, pseudo-GTID and other related files.

  1. Create a orchestrator.conf.jsonconfiguration to configure
    insert image description here
    the main content of the Orchestrator configuration file:
"MySQLTopologyUser": "boo",  -- 被管理的MySQL的用户
"MySQLTopologyPassword": "boo123456",  -- 被管理的MySQL的密码
 "MySQLOrchestratorHost": "127.0.0.1",   -- orch后端数据库(orchestrator)地址 与 orchestrator在一个服务器
 "MySQLOrchestratorPort": 3306,
 "MySQLOrchestratorDatabase": "orchestrator", -- orch后端数据库名
 "MySQLOrchestratorUser": "boo_orch",  -- orch后端服务数据库用户名(明文)
 "MySQLOrchestratorPassword": "boo_orch123456",   -- orch后端服务数据库密码(明文)

The complete configuration file is available here: https://download.csdn.net/download/HELLOMRP/87244660

run deployment

Server environment:

Three mysql services are on three servers

  1. Mysql enables GTID,
    you can refer to mysql online enable/disable GTID
  2. MySQL instance and master-slave structure
Master :192.168.1.16:3306
Slave1  :192.168.5.128:3306
Slave2  :192.168.5.129:3306
  1. hosts (location: etc/hosts) Configure as needed:
192.168.1.16 boo_mysql_1
192.168.5.128 boo_mysql_2
192.168.5.129 boo_mysql_3

Create an account

  1. Create an account in the orchestrator backend service database (192.168.1.16) for the orchestrator background service to access the orchestrator database
CREATE USER 'boo_orch'@'127.0.0.1' IDENTIFIED BY 'boo_orch123456';
GRANT ALL ON orchestrator.* TO 'boo_orch'@'127.0.0.1'; 

The orchestrator service is on the same server as the database, so the created user only allows 127.0.0.1 access and grants it permissions.

  1. Create an account in the managed database (master, slave) for master-slave replication data interaction
CREATE USER 'boo'@'%' IDENTIFIED BY 'boo123456';
GRANT SUPER, PROCESS, REPLICATION SLAVE, RELOAD ON *.* TO 'boo'@'%';
GRANT SELECT ON mysql.slave_master_info TO 'boo'@'%';
GRANT SELECT ON meta.* TO 'boo'@'orc_host';

Configure the master-slave library

According to the above "MySQL instance and master-slave structure" , configure it as one master and two
slaves

turn on

./orchestrator --debug --config=/etc/mysql/orchestrator.conf.json http

Running error: FATAL Error 1049: Unknown database 'orchestrator'
indicating that the "orchestrator" database is missing, create an orchestrator database on 5.128

Running error: The MySQL server is running with the --read-only option so it cannot execute this statement
Add database operation permission to database user boo_orch

In the browser, enter the server IP and port where the orchestrator service is located (http://192.168.1.16:3000) to enter the web management interface
insert image description here
insert image description here

Guess you like

Origin blog.csdn.net/HELLOMRP/article/details/128186572