Migrating a MariaDB to Cloud Spanner
Google Cloud Spanner is a relational database service which is highly consistent, available and scalable horizontally. It is a fully managed service suitable for OLTP workloads and low-latency/high-throughput environments. In this recipe, we'll understand the features of Spanner in relation to a popular RDBMS, MariaDB. We'll take a simple MariaDB database and move the schema and the data to Cloud Spanner. At the time of writing, there is no automated import/export tool for Cloud Spanner, the manual method gives us a glimpse of the way Spanner is built and its strengths/weaknesses. Firstly, we'll export the data from our MariaDB database using the mysqldump
utility. Then, we'll create the database and tables via the Google Console. Finally, we'll insert the data into the table via a Python script.
Getting ready
The following are the initial setup verification steps to be carried out before the recipe can be executed:
- Create or select a GCP project
- Enable billing...