Galera Manager supports three modes for supporting your MariaDB Galera Clusters: deploying to either Amazon Web Services or DigitalOcean, deploying to your own on premises hosts, and also just monitoring your clusters. In this blog post, we will go thru houw you should deploying a 3-node MariaDB Galera Cluster via Galera Manager on Amazon Web Services Elastic Compute Cloud (AWS EC2). You will realise that this process happens with just a simple API key and instance selection, so effectively you can have a Galera Manager setup in under fifteen minutes!
On AWS EC2, it is worth noting that Galera Manager itself can be deployed on the free tier for testing purposes. However, in production environments, you might expect up to 100GB of logs on a monthly basis, so you should plan accordingly.
Obtain Galera Manager by filling in the form. Logon to your AWS Console. Launch just one EC2 instance. You are advised to read the supported OS matrix which can change as releases abound; for this particular example, we will use a base of Ubuntu Server 22.04 LTS. Please ensure to use the 64-bit (x86) option, not the Arm variant, as Galera Manager is meant for x86_64 platforms only. Either create a new key pair, or ensure you already have an existing key pair. We cover all this in the first minute of the video. The rest of the defaults are fine (you can tick the Allow HTTPS and HTTP traffic from the internet as options), so go right ahead and launch an instance.
Now you’ll need to login, and you can do so similarly:
ssh -i gmd.pem ubuntu@3.64.252.66
You can now execute:
sudo su
to become the root user, then type cd to ensure that your current working directory is /root. Now grab the gm-installer either via scp or wget it to your host. The direct link is in the video or the documentation! It is time to make the installer executable, which you do by typing: chmod +x gm-installer. Verify the version:
./gm-installer version gm-installer version 1.12.0 (linux/amd64)
To get started, simply execute:
./gm-installer install
Accept the license agreement, enter the admin password, enter the IP (this means that you will get an install over insecure HTTP) or hostname (this install thus executes over secure HTTPS), and you’re on your way to getting your Galera Manager host installed.
Typically this installation process takes less than 5 minutes, as it has to pull in packages from multiple repositories. Once the installation is complete, you will see something similar to the following:
▋INFO[0218] Galera Manager installation finished. Enter http://3.64.252.66 in a web browser to access. Please note, you chose to use an unencrypted http protocol, such connections are prone to several types of security issues. Always use only trusted networks when connecting to the service. INFO[0218] Logs DB url: http://3.64.252.66:8081 IMPORTANT: ensure TCP ports 80, 8081 are open in firewall. INFO[0218] Below you can see Logs DB credentials: DB name: gmd DB user: gmd DB password: Soq3EXzYcn The installation log is located at /tmp/gm-installer.log
Typically this tells you how to access Galera Manager. It also tells you that you need to open up ports 80 and 8081. And if anything did go wrong, you will be able to find out more at the installer log.
So let us do so within Amazon’s configuration for inbound rules in Security groups: opening up TCP ports 80, 8081. 443 will also apply if you’re using HTTPS. It is at 5:30 in the video.
Enter the URL and you will now see the login screen, fill in your credentials that you entered on the command line earlier. As you can see, by default there are no clusters, and when you click on it, you are given options to deploy a fully managed cluster, or to deploy a cluster on user-provided hosts, and finally just to monitor an existing cluster. For the purpose of this document, we are going to take option 1 and deploy fully managed clusters.
You’ll notice that you’re asked for an AWS Access Key ID and an AWS Secret Access Key. It is only with that, and the ability to pass the credential check, that you’ll be able to select a region and instance type. Go back to your AWS console and get to Security Credentials by clicking on your name on the top right hand corner. Then you should create an Access Key and you will be able to retrieve your access key and show your secret access key. Copy and paste those details into your Galera Manager setup. If there are errors, you will know, and if everything is green, you’re good to select a region and instance type.
In this example, we will continue using the eu-central-1 region and use a t2.medium instance for the 3 MariaDB Galera Cluster nodes. Note that you are unlikely to be able to deploy successfully on anything smaller, so it is also disabled in the Galera Manager GUI.
You can now just go right ahead and click ADD NODES. Ensure that you’re adding 3 nodes, and let Galera Manager do the magic of deploying for you. In under five minutes or so, you’ll likely have a 3-node MariaDB Galera Cluster running for you.
We opted to login using the SSH terminal within the web browser and can verify we have deployed a 3-node Galera Cluster.
Happy deploying your MariaDB Galera Clusters in Amazon EC2 with Galera Manager!