blog

Multi-Cloud Deployment for MySQL Replication

Agus Syafaat

Published

In recent years, the use of platform infrastructure has shifted from on-premise to cloud computing. This is based on the absence of cost capital costs that must be incurred by the company if used when implementing IT infrastructure. Cloud computing provides flexibility in every line of resources ie. on human resources, energy, time savings.

Cloud computing makes it easy for organizations to do IT planning, executing, maintaining platforms to support business interests.

But both have similarities, we had to think about BCP (Business Continuity Plan) and Disaster Recovery Plan (DRP) when using the cloud. Data storage becomes critical when we talk about DRP, how fast we do recovery (Recovery Point Objective) when a disaster occurs. Multi-cloud architecture plays a big role when we want to design and implement infrastructure in the cloud environment. In this blog, we review the related multi-cloud deployment for storing data in MySQL.

Environment Setup in the Cloud

This time we use Amazon Web Service (AWS), which is widely used by companies, and Google Cloud Platform (GCP) as the second cloud provider in a multi-cloud database setup. Making instances (the term used in cloud computing for new Virtual Machines) on AWS is very straight forward. 

AWS uses the term Amazon EC2 (Elastic Compute Cloud) for their compute instance service. You can login to AWS, then select EC2 service.

Here’s the display of an instance that has been provisioned with EC2.

For security reasons, which is the biggest concern of cloud services, make sure we only enable ports that are needed when deploying ClusterControl, such as SSH port (22), xtrabackup (9999), and database (3306) are secured but reachable across the cloud providers. One way to implement such connectivity would be to create a VPN that would connect instances in AWS with instances in GCP. Thanks to such design, we can treat all instances as local, even though they are located in different cloud providers. We will not be describing exactly the process of setting up VPN therefore please keep in mind that the deployment we present is not suitable for real-world production. It is only to illustrate possibilities that come with ClusterControl and multi-cloud setups.

After completing the AWS EC2 Setup, continue with setting up the compute instance in GCP, in GCP the compute service is called Compute Engine.

In this example, we will create 1 instance in the GCP cloud which will be used as one of the Slaves. 

When it is completed, it will be shown in the management console as below:

Make sure you secure and enable port SSH port (22), xtrabackup (9999) and database (3306).

After deploying instances in both AWS and GCP, we should continue with the installation of ClusterControl on one of the instances in the cloud provider, where the master will be located. In this example setup, we will use one of the AWS instances as the Master. 

Deployment MySQL Replication on Amazon Web Service 

To install ClusterControl you should follow simple instructions that you can find on Severalnines’ website. Once ClusterControl is up and running in the cloud provider where our master is going to be located (in this example we will use AWS for our master node) we can start the deployment of MySQL Replication using ClusterControl. There are following  steps you need to take to install MySQL replication cluster:

Open ClusterControl then select MySQL Replication, you will see three forms need to be filled for the installation purpose

General and SSH Settings

Enter SSH User, Key and Password, SSH Port and the name of the cluster

Then select ‘Continue’

Define MySQL Servers 

Select vendor, version number, and root password of MySQL, then click ‘Continue’

Define Topology

As you remember, we have two nodes created in AWS. We can use both of them here. One shall be our master, the other should be added as a slave. Then we can proceed with ‘Deploy’

If you want, and if the cross-cloud connectivity is already in place, you can also set the GCP Instance IP address under ‘Add slaves to master A’ then continue with ‘Deploy’. In this way, ClusterControl will deploy master and both slaves at the same time. 

Once started the deployment you can monitor the progress in the Activity tab. You can see the example of the progress messages below. Now it’s time to wait until the job is completed.

Once it is completed, you can see the newly created Cluster named “Cloud MySQL Replication”.

If you already added GCP node as a second slave in the deployment wizard, you have already completed the Master-Slaves setup between AWS and GCP Instances.

If not, you can add the GCP slave to the running cluster. Please make sure that the connectivity is in place before proceeding further.

Add a New Slave from Google Cloud Platform

After MySQL Replication on AWS has been created, you can continue by adding your node in GCP as a new slave. You can accomplish that by performing the following steps::

  1.  
  1. On the cluster list find your new cluster and then  click on  and  select ‘Add Replication Slave’
      1.  
      1.  
  2. Add Replication Slave’ wizard will appear, as you can see below.
  3. Continue by picking the  IP of Master Instance (located in AWS)  and entering the IP address and Port of GCP instance that you want to use as a slave in the ‘Slave Hostname / IP’ box. Once you fill everything, you can proceed with clicking on ‘Add Replication Slave’.

As before, you can monitor the progress in the activity tab. Now it’s time to wait until the job is completed.

Once the deployment is done we can check the cluster in the topology tab.

You can see the topology of our Master-Slave cluster below.

As you can see, we have a master and one slave in AWS and we have as well a slave in GCP, making it easier for our database to survive any outages that happen in one of our cloud providers.

Conclusion

For the high-availability of database services, a multi-cloud deployment takes a very important role to make it happen. ClusterControl is created to navigate this process and make it easier for the user to manage the multi-cloud deployments. 

One of the critical things to consider when doing Multi-Cloud Deployment is security aspects. As we mentioned earlier, you can setup a VPN Site to Site between the two cloud providers as the best practice that can be applied. There are also other options like SSH tunnels.

Subscribe below to be notified of fresh posts