<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Homero Valle on Medium]]></title>
        <description><![CDATA[Stories by Homero Valle on Medium]]></description>
        <link>https://medium.com/@hvalle?source=rss-73c77828de79------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*tsC-6_GG86YlK2IMyLVwZQ.jpeg</url>
            <title>Stories by Homero Valle on Medium</title>
            <link>https://medium.com/@hvalle?source=rss-73c77828de79------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:52:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hvalle/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Moving to Google Cloud SQL the right way]]></title>
            <link>https://medium.com/mollie-payments/moving-to-google-cloud-sql-the-right-way-ef9a2215eed8?source=rss-73c77828de79------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef9a2215eed8</guid>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[cloud-sql]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Homero Valle]]></dc:creator>
            <pubDate>Tue, 01 Oct 2019 12:11:09 GMT</pubDate>
            <atom:updated>2019-10-01T12:33:32.505Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GW0so1_-Vg-kuKDB6EXWZw.jpeg" /><figcaption>Illustration by <a href="https://www.svenfranzen.com/">Sven Franzen</a>.</figcaption></figure><p>Migrating to the cloud is not a new thing. According to a <a href="https://www.logicmonitor.com/resource/the-future-of-the-cloud-a-cloud-influencers-survey/">LogicMonitor’s survey</a>, <em>83% of enterprises will be in the Cloud by 2020</em>. With this clear trend, it is important to use the right tools and especially have the right mindset when migrating, even more so when migrating <em>databases</em>.</p><p>With some regularity, we hear about how companies destroy or <a href="https://about.gitlab.com/2017/02/01/gitlab-dot-com-database-incident/">lose their crown jewels</a>. When these kind of situations happen, people should remember that there are no shortcuts to doing things the right way. Sometimes we can feel the urge to migrate to the cloud quickly, but by doing so we run the risk of missing important steps that can give us peace of mind in all stages of a migration.</p><p>At Mollie, we follow very strict rules, and we also want peace of mind, especially when handling other people’s money. To quote a senior Mollie engineer:</p><blockquote><em>“People seem to really care about money!”</em></blockquote><p>So let’s try to also care about our databases and their data, the same way we care about their money.</p><h3>Understanding the peculiarities of Cloud SQL</h3><p>Moving from on-premises to the Cloud brings many new challenges that we need to consider. Within this article we are specifically talking about Google Cloud SQL for MySQL so these examples and points made might not all be valid when looking at the Cloud SQL for Postgres SQL product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*gROdlbU3Z4mWfeZowIgMzg.png" /></figure><h4>Configuration</h4><p>Because Google will manage your MySQL instance, there are many configuration values which are not available to us. If you are used to tweaking and changing every setting, then Cloud SQL will not be for you. But for us this isn’t really an issue, since the sane defaults and <a href="https://cloud.google.com/sql/docs/mysql/flags#list-flags">supported flags</a> work for us. In exchange, we get a managed MySQL instance in the Cloud.</p><p>For example, you can no longer set <em>innodb_buffer_pool_size</em> to your desired value. Instead, Cloud SQL will select an optimized value for it, which is one less thing to worry about!</p><h4>Performance</h4><p>A big sell on the cloud is scalability, but at first performance might take a hit. You are expected to scale horizontally, not vertically.</p><p>One major aspect to worry about is storage speed. Cloud SQL calculates IO quotas based on the number of CPUs and the disk size of your instance. You can definitely get good speeds, but they will never be the same as having locally attached SSDs on your on-premises rack. Storage in Cloud SQL is network attached, so be prepared to suffer noticeably in IO performance when you migrate.</p><h4>Access and security</h4><p>There are two levels of access that Cloud SQL supports: <em>instance</em> and <em>database</em> level access. Database access uses the <a href="https://dev.mysql.com/doc/refman/5.7/en/access-control.html">MySQL Access Privilege System</a>, so that’s nothing new, but Instance access requires choosing one of <a href="https://cloud.google.com/sql/docs/mysql/instance-access-control#instanceaccess">several options available</a>, where one will suit your needs more than others.</p><p>One of them, <a href="https://github.com/GoogleCloudPlatform/cloudsql-proxy">Cloud SQL Proxy</a>, is very easy to use and will help you secure connections between your on-premises systems and the cloud. Just be aware that having your application and your database split this way can have a great impact on latency. We saw, on average, an increase from ~5 ms to a whopping ~40 ms. You will have to decide if this is acceptable or not.</p><p>When accessing the instance you can also do it through private or public IPs. While using public IP addresses to grant access might sound the easiest, it is not recommended for security reasons.</p><p>Using a <a href="https://cloud.google.com/sql/docs/mysql/private-ip">private IP</a> is more secure, but also more cumbersome to get right. We would need to use a <a href="https://cloud.google.com/vpc/docs/overview">VPC</a> (Virtual Private Cloud), which provides flexible networking for your cloud-based resources and services.</p><p>When using a private IP, Google will create a Google-managed <a href="https://cloud.google.com/vpc/docs/overview">VPC</a>, and place your new Cloud SQL instance there, then it will create a <a href="https://cloud.google.com/vpc/docs/vpc-peering">VPC-peering</a> between the Google-managed VPC and a VPC of your choice.</p><p>One problem with having Cloud SQL inside this Google-managed VPC is that, at least at the time of writing this blog post, <em>it’s not possible to connect across VPC peering’s</em>, so only resources in the attached VPC will have access to the database. If you have resources from multiple VPCs that need access to the database, you might need to consider attaching the Google-managed VPC to a <a href="https://cloud.google.com/vpc/docs/shared-vpc">Shared VPC</a>.</p><h4>Replication and High Availability</h4><p>Cloud SQL only supports master to one or more read slaves. It also only supports failing over to one of the read slaves. So, the topology of replication and fail-over is quite limited. Please take this into consideration to see if CloudSQL is right for you.</p><p>And even though you have a High Available Cloud SQL instance, <strong>maintenance windows of Cloud SQL will cause small downtimes</strong>. In our experience, these take no more than 5 minutes, and occur twice per year, approximately. If you cannot tolerate this, Cloud SQL might not be for you.</p><h4>Backing up and restoring</h4><p>A nice feature Cloud SQL has is the managed backup functionality. This will create a daily backup for up to 1 week in the past. Restoring is painless and easy. You can also restore to a specific PIT (point-in-time), which can be a life saver. Think of an instance where your data somehow gets corrupted and restoring everything to a specific point in time is the only way back to a working state.</p><p>While having managed backups is nice, if you accidentally delete your Cloud SQL instance, these backups will be gone as well. But even if you somehow manage to accidentally delete your Cloud SQL instance, you can contact support, and they can un-delete it for you. This is probably related to the restriction of not being able to re-use CloudSQL instance names for a certain period of time.</p><h4>Dive deeper into Cloud SQL</h4><p>To really understand Cloud SQL, there’s really no better place than the <a href="https://cloud.google.com/sql/docs/mysql/">official Google Cloud SQL documentation</a>. I really suggest reading it through to get a good feel for CloudSQL.</p><h3>MySQL database migration tool</h3><p>Google Cloud Platform provides a <a href="https://console.cloud.google.com/sql/migrate/begin">tool for migrating</a> your current MySQL instance to Cloud SQL. This is what it looks like when you start migrating using the tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*WBJ7tbp_ynPrA8FPMf1qAw.png" /><figcaption>Screenshot of the Cloud SQL migration tool</figcaption></figure><p>The tool looks quite easy to use, but you can only use it when you have completed certain <a href="https://cloud.google.com/sql/docs/mysql/replication/replication-from-external#server-requirements">pre-requisites on your source database</a>. Some of the most important ones are:</p><ul><li>MySQL 5.6 or 5.7</li><li><a href="https://dev.mysql.com/doc/refman/5.7/en/replication-gtids-concepts.html">GTID</a> enabled</li><li>Binary logs enabled</li><li>An externally accessible IPv4 address</li></ul><p>Satisfying the tool’s pre-requisites might take some time depending on your setup. Remember that any change to your current setup could affect the stability of the database. It’s always good to be thorough and test every change you make.</p><p>Because of the requirement for <em>externally accessible IPv4 address, </em>this tool was not feasible for us. You should consider your options carefully and understand the risks of this requirement.</p><p>For the complete guide on migrating using this tool, see <a href="https://cloud.google.com/sql/docs/mysql/migrate-data">Migrating data between Cloud SQL and external servers</a>.</p><h3>Test, and test well</h3><p>There are many aspects that you need to test before starting the migration, some of which might need more attention depending on your setup. You must feel confident about the ins and outs of Cloud SQL and about the migration process.</p><ul><li><strong>Slow queries</strong>: You need to know your application will behave the same or better after you migrate. Fully test your application with the new database to weed out any queries that might need optimizing or changing. You could also use Percona’s amazing <a href="https://www.percona.com/blog/2012/10/25/replaying-database-load-with-percona-playback/">Playback</a> tool to benchmark your old database vs Cloud SQL. This tool might look like abandonware since no distribution really supports it anymore. So, you might need to compile it yourself from <a href="https://github.com/Percona-Lab/query-playback">source</a>, but the tool still works great and it’s worth the effort.</li><li><strong>Latency</strong>: Having your application and database in separate datacenters will certainly increase latency, so test this and make sure you understand the consequences of having slower connections. You might face some race conditions you never saw before because you could expect things to be fast.</li><li><strong>Backups</strong>: Perform backups and test restoring from them, document how to make the backups and what to do in case you would want to restore it.</li><li><strong>Disaster recovery:</strong> Document and make a schedule to regularly test the different scenarios. What if the region is down? What if the instance is deleted? What if there is data corruption?</li><li><strong>Dry-Runs:</strong> Do dry-runs, a rehearsal of the procedure before the real one, if you are able to. These will weed out many unexpected or overlooked aspects of a migration.</li></ul><h3>Planning better uses less brain cells</h3><p>When you’ve finished all your testing, you will have produced a good game plan for the day of the migration. It will be clear to you what will happen, so that you will not have to think about the “what-if’s” as much. And because you understand what’s happening, your rollback scenarios will be very clear too.</p><h3>Final words</h3><p>The most important thing to take away from all of this is that preparation is key. Take your time to read over documentation for Cloud SQL, test multiple scenarios, don’t take shortcuts and definitely don’t skip testing.</p><p>Also, test the migration tool so you understand the requirements and get your source database ready for it. It may take you some time getting requirements checked off in your source database.</p><p>If you prepare and test well, the day of the migration might actually be a bit boring. But afterwards you’ll feel much better, knowing that there were no surprises left to find.</p><p>Take a look at the <a href="https://cloud.google.com/sql/docs/mysql/launch-checklist">launch checklist</a> for Cloud SQL MySQL that Google made available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef9a2215eed8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mollie-payments/moving-to-google-cloud-sql-the-right-way-ef9a2215eed8">Moving to Google Cloud SQL the right way</a> was originally published in <a href="https://medium.com/mollie-payments">Mollie</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>