-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Gonarch HA is a tool created in Python3 to implement a full high availability solution for MySQL, all in one. The capabilities you will find here:
- Load balancing
- Traffic routing and splitting based on read or wirte traffic
- Replication manager (auto failover, auto rejoin, node discovery)
The hierarchy in Gonarch is as follows: Workspace > Cluster > Node group > Node
Workspace: This represents the Gonarch instance or service that is running on your server. You can have only one per server.
Cluster: A cluster of databases that is composed of a primary and one to many replicas. You can have many clusters in one Workspace.
Node group: (Not implemented) A logical group of nodes. The idea is to perform actions on this group that will affect all the nodes underneath.
Node: The representation of a single database instance.
NOTE: This tool is currently under development, so take it with curiosity and eagerness for fun, but not for production
Gonarch HA is released under GNU licensing and everything was developed in house except the load balancing layer that right now is relying on HAProxy (Open source project version) but it will be replaced by a own built module at some point.
Gonarch HA has been tested so far in Ubuntu server 20 and 22 (Currently testign on Centos 7) and it's compatible with MySQL 5.7 and 8.0. Considering the different package version that this tool needs (such as Python 3.10) it's recommended to install Gonarch HA in a dedicated host.
Ensure that you follow this configuration to ensure ACID compliance and data integrity during failovers
sync_binlog = 1
report_host = hostname
binlog_format = ROW
innodb_flush_log_at_trx_commit = 1If multithread replication is on (default behavior in MysQL 8):
gtid_mode = ON
enforce_gtid_consistency = ONThe Gonarch account must be present in all the nodes. Create this account in the master and ensure it gets replicated to all the replicas in the cluster.
CREATE USER 'gonarch'@'%' IDENTIFIED BY 'strong_password';
GRANT RELOAD, PROCESS, SUPER, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'gonarch'@'%';Once you have confirmed that the database requirements are met, proceed to download the tar file from the provided location and extract it on the server. Next, execute the install.sh script, and the installation process will be automated for you. Throughout the installation, you will be prompted to enter the workspace name and the IP address of the server where Gonarch will be running. This information will be utilized to generate the connection endpoints.
Gonarch will install these 3 services:
- gonarch-api: Service to run the API
- gonarch-check: Socket client that communicates with the different MySQL nodes.
- gonarch-core: Main engine that perform all the operations. It acts as a socket server that receives info from check.
- Edit gonarch.conf located at /etc and udpate accordingly.
- Restart all the Gonarch services to ensure that the new configuration takes place
- Add a new cluster using the API
- Now you should have 2 endpoints ready to be used: One for writes and one for reads.
- A pretty rudimentary, yet useful, script is in the gonarch folder called check_status.sh. This script shows the Gonarch services and HAproxy status. For example:
Gonarch service check
Timestamp: 2023-06-29 10:13:57
==========================
gonarch-api: active
gonarch-core: not reachable
gonarch-check: active
HAProxy load balancer layer
==========================
# pxname svname status
mysql8-eu_reader FRONTEND OPEN
mysql8-eu_reader mysql-europe-03 no check
mysql8-eu_reader mysql-europe-02 no check
mysql8-eu_reader mysql-europe-01 no check
mysql8-eu_reader BACKEND UP
mysql8-eu_writer FRONTEND OPEN
mysql8-eu_writer mysql-europe-02 no check
mysql8-eu_writer BACKEND UP