Skip to content
Rafa Alvarez edited this page May 31, 2023 · 12 revisions

What is Gonarch HA?

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

Licensing

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.

Installation and initial setup

Compatibility

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.

MySQL parameters setup

Ensure that you follow this configuration to ensure ACID compliance and data integrity during failovers

sql_binlog = 1

report-host properly setup

binlog-format = ROW

innodb_flush_log_at_trx_commit = 1

If multithread replication is on (default behavior in MysQL 8):

gtid_mode = ON

enforce_gtid_consistency = ON

MySQL accounts

The 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'@'%';

Installation

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.

After installation

  • 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.

Clone this wiki locally