How to deploy a true multi-cloud database on PlanetScaleDB

March 31, 2020

·

Lucy Burns

True Multi-Cloud Database Deployment is Here

We have just announced PlanetScaleDB's true multi-cloud and multi-region capabilities. A true multi-cloud database offers the ability to seamlessly move from one cloud provider to another without the pain of a lengthy migration. With a true multi-cloud database, you can move across cloud providers simply by failing over from a master in one cloud provider to a replica in a second cloud provider. 

The multi-cloud and multi-region clusters are currently in beta, but will be generally available within the next 90 days. We’ll be iterating on these features in the meantime to improve user experience and reliability, and we would love to hear your feedback

We built PlanetScaleDB on the open source project Vitess because of its ability to run distributed databases at massive scale. Additionally, Vitess was built at Google to run on Borg, the blueprint for Kubernetes, making Vitess Kubernetes-ready by design. This gives us the advantage of running our fully managed database-as-a-service on Kubernetes. 

Why is this powerful? With Kubernetes, we can create the abstractions required to deploy and run PlanetScaleDB anywhere. Instead of relying on individual cloud provider configurations, we used the operator design pattern and created a standard Kubernetes API that makes it easy to deploy and manage the master and replicas for a single database in multiple cloud providers. 

How to Deploy a Multi-Cloud Cluster

We’ve made it easy to set up a multi-region or multi-cloud database. While our multi-cloud and multi-region databases on PlanetScaleDB are in beta and should not be used for production workloads, you can get started right away by creating an account here

1. Create a multi-cloud cluster

To create a multi-cloud cluster, click on the “Create New Cluster” button in the cluster overview page. Name your cluster and select the “Multi-Region and Multi-Cloud” deployment option. You will now have the opportunity to select one or more cloud providers and one or more regions per cloud provider. We recommend selecting AWS us-west-2, us-east-1  and GCP us-west1 to get started.

2. Create a multi-cloud database

Once you have created a multi-cloud cluster, you can create a multi-cloud database within the cluster. Click “Create Database” to get started. Name your database and then select all three available regions. You can adjust the instance configuration as needed and select the number of instances per region; selecting one database instance means that each region will contain one database instance.  

Note: Our beta does not yet support choosing a region for the master database instance, but this functionality is coming soon. 

The easiest way to test a multi-cloud database is to use one shard. 

Now click "Create Database" to deploy your database in AWS and GCP.

3. Apply a schema to your database 

Apply a schema to your database from the database overview page. Click the “Edit” button on the Schema card.

Paste your schema into the drawer and click the red “Apply Schema Migration” button.

4. Connecting to your multi-cloud database

Once your database has deployed, connect to it using a MySQL connection string. You can find the connection string from either the cluster page or the database page by clicking on the green “Connect” button in the upper right hand corner of the page.

5. Examine your true multi-cloud topology

Once you have connected to your database, you can view the topology. Use the statement SHOW vitess_tablets to see the master and replicas distributed across regions in AWS and GCP.

You can write to this database using the connection string for any of the database instances. The idea is to use the connection string close to the region where your application servers are running. 

Now you’ve deployed your first true multi-cloud database! Whether you’re looking for a stronger disaster recovery story, geographic reach beyond a single provider, or the ability to migrate from one cloud provider to another, PlanetScaleDB true multi-cloud provides flexibility of deployment across regions and cloud providers.