Follower Clusters – 3 Major Use Cases for Syncing SQL & NoSQL Deployments
Tags: mysql, mongodb, postgres, database
Published: 2020-01-20 22:25:37

---
title: Follower Clusters – 3 Major Use Cases for Syncing SQL & NoSQL Deployments
published: true
description: Follower clusters allows you to sync two DB clusters. Learn the top use cases for MongoDB, MySQL and Postgres: analyze, optimize and test app performance. ScaleGrid blog
tags: MySQL, MongoDB, PostgreSQL, Database,
---
<link rel=“canonical” href=“https://scalegrid.io/blog/follower-clusters-3-major-use-cases-for-syncing-sql-and-nosql-deployments/” />
<a href="https://scalegrid.io/blog/follower-clusters-3-major-use-cases-for-syncing-sql-and-nosql-deployments/"><img src="https://scalegrid.io/blog/wp-content/uploads/2020/01/Follower-Clusters-3-Major-Use-Cases-for-Syncing-SQL-and-NoSQL-Deployments-ScaleGrid-Blog.jpg" width="100%" height="auto"></a>
<p style="text-align: justify;"><a style="color: #2da964;" title="MongoDB Follower Clusters" href="https://help.scalegrid.io/docs/mongodb-follower-clusters-scheduled-sync" target="_blank">Follower clusters</a> are a ScaleGrid feature that allows you to keep two independent database systems (of the same type) in sync. Unlike cloning or replication, this allows you to maintain an active, point-in-time copy of your production data. This extra cluster, known as a follower cluster, can be leveraged for multiple use cases, including for analyzing, optimizing and testing your application performance for <a style="color: #2da964;" title="MongoDB on ScaleGrid" href="https://scalegrid.io/mongodb.html" target="_blank">MongoDB</a>, <a style="color: #2da964;" title="MySQL on ScaleGrid" href="https://scalegrid.io/mysql.html" target="_blank">MySQL </a>and <a style="color: #2da964;" title="PostgreSQL on ScaleGrid" href="https://scalegrid.io/postgresql.html" target="_blank">PostgreSQL</a>. In this blog post, we will cover the <a style="color: #2da964;" title="Follower Clusters – 3 Major Use Cases for Syncing SQL & NoSQL Deployments" href="https://scalegrid.io/blog/follower-clusters-3-major-use-cases-for-syncing-sql-and-nosql-deployments/" target="_blank">top three scenarios to leverage follower clusters for your application</a>.</p>

<h2 style="padding-top: 15px;">How Do Follower Clusters Differ From Replication?</h2>
<p style="text-align: justify;">Unlike a static clone, this data imports on a set schedule so your follower cluster is always in sync with your production cluster. Here are a few critical ways in which it differs from replication:</p>

<ul style="text-align: justify;">
	<li>You can control how frequently the destination system syncs from source - once a week, once a day, or even less frequently. This helps reduce the load on the source system.</li>
	<li>Since they are two independent systems, you have much more flexibility over the data that is synced. You can have different user credentials and even remove some data from the destination based on security requirements (note: This requires user-side scripting - it is not an in-built feature of follower clusters).</li>
	<li>The ‘follower’ system is writable, so you can use it as a staging environment to test your application changes. This is not something you can do on a replica node.</li>
</ul>
<p style="text-align: justify;"><i>Note: ScaleGrid implements follower clusters using storage snapshots. It is not available for our in-memory database offerings like <a style="color: #2da964;" title="Redis™ on ScaleGrid" href="https://scalegrid.io/redis.html" target="_blank">hosting for Redis™*</a>.</i></p>

<h2 style="padding-top: 15px;">1. Database Dev/Test Setup</h2>
<p style="text-align: justify;">We have all been there - a supposedly well-tested piece of code is deployed in production, and then all hell breaks loose. Production workflows fail, or are so slow they are basically unusable. Engineers are woken from their beds to start a full blown fire fighting operation. A bunch of sleepless nights later, that dreaded root cause emerges.</p>
<p style="text-align: justify;"><strong>Application behaves differently on production and engineering setups.</strong></p>
<p style="text-align: justify;">In other words, we tested it on “test data”. Which, as it turns out, was nothing like the production data. At all.</p>
<p style="text-align: justify;">The obvious way to avoid this situation is to run tests on your production data. Not actual production of course - that will be flirting with disaster. On a cloned copy of the production data. While concerns around privacy and data security make this impracticable in many scenarios, privacy requirements permitting, this is the best solution. We no longer need to rely on engineers generating appropriate data sets - if it passes on test data, it will pass on production data.</p>
<p style="text-align: justify;">That is, until test data falls so far out of sync with production that it is no longer a good approximation. And we are back at square one.</p>
<p style="text-align: justify;">This is where follower clusters come in.</p>
<p style="text-align: justify;">By using follower clusters, you can periodically import data from your production database into the dev/test database. And since the entire import is performed using storage snapshots, rather than a logical dump, the process is nearly instantaneous. You can schedule your imports once every 24 hours, once a week, or whatever frequency suits your particular scenario.</p>
<p style="text-align: justify;">With your development and QA clusters set to follow the production cluster, you can rest easy. If your application passes on the test dataset, it is definitely fit to deploy in production!</p>

<h2 style="padding-top: 15px;">2. Data Analytics</h2>
<p style="text-align: justify;">If you have worked as a DBA, you’ve probably had a conversation with your team about system performance “mysteriously” slowing down at certain times. In most cases, the culprit turns out to be an analytics job that is accessing tons of data and ends up slowing down the entire system.</p>
<p style="text-align: justify;">As a DBaaS vendor, we have had this conversation multiple times with our customers. Here are the two options we typically suggest:</p>

<ul style="text-align: justify;">
	<li>If the analytics job is running on the primary/master server, move it to a secondary/replica server.</li>
	<li>If the analytics job is already running on a secondary node, and the performance degradation is unacceptable, we recommend moving the jobs to a dedicated analytics cluster.</li>
</ul>
<p style="text-align: justify;">Using our follower cluster feature, it’s very easy to keep an analytics cluster up-to-date with actual production data. You can create a follower schedule to sync the latest data from production just before your analytics job kicks in.</p>
<p style="text-align: justify;">The best part? Follower syncing does not perform any database level operations - it merely restores the latest snapshot! So, there is zero impact on your production cluster.</p>

<h2 style="padding-top: 15px;">3. Reporting</h2>
<p style="text-align: justify;">Another common use case where our customers use the follower clusters feature is for report generation. Reporting processes typically run infrequently, but access large quantities of data and take up most of a database cluster’s resources. When the performance degradation is unacceptable, we recommend our customers move the reporting workload to a new cluster.</p>
<p style="text-align: justify;">Since reporting operations are infrequent, many of our customers prefer to leverage our pause/resume feature to ‘pause’ reporting clusters when they are not in use. This helps save massively on infrastructure costs. Typically, reporting clusters are also much “smaller” (lesser CPU/RAM), to help reduce costs.</p>
<p style="text-align: justify;">After you have created a follower cluster from our UI, you could use this workflow to automate your reporting flow:</p>

<ol style="text-align: justify;" type="i">
	<li>Use our <a style="color: #2da964;" title="ScaleGrid API Doc" href="https://scalegrid.io/api/#operation/resumeCluster" target="_blank">resume API</a> to resume the cluster.</li>
	<li>Wait until the cluster is back in running state (you can use your <a style="color: #2da964;" title="ScaleGrid API Doc" href="https://scalegrid.io/api/#operation/getJobStatus" target="_blank">get-status API</a> for this purpose).</li>
	<li>Trigger a backup on your production cluster, if required (typically, if regular backups are scheduled on your production, you can skip this step. However, if you want your reporting to run on the latest data, this is essential).</li>
	<li>Wait for the backup to complete.</li>
	<li>Trigger a <a style="color: #2da964;" title="ScaleGrid API Doc" href="https://scalegrid.io/api/#operation/syncFollowerClusterNow" target="_blank">sync job</a> on the follower - this finds the latest snapshot on the source cluster and restores to the destination.</li>
	<li>Wait for the sync job to complete.</li>
	<li>Run your reporting tasks.</li>
	<li>Use our <a style="color: #2da964;" title="ScaleGrid API Doc" href="https://scalegrid.io/api/#operation/pauseCluster" target="_blank">pause API</a> to pause the cluster till your next reporting job!</li>
</ol>
<p style="text-align: justify;">Do you think follower clusters are a good fit for your particular user case? You can learn all about how to deploy and manage follower clusters for <a style="color: #2da964;" href="https://help.scalegrid.io/docs/mongodb-follower-clusters-scheduled-sync" target="_blank">MongoDB</a>, <a style="color: #2da964;" href="https://help.scalegrid.io/docs/mysql-follower-clusters-scheduled-sync" target="_blank">MySQL</a> and <a style="color: #2da964;" href="https://help.scalegrid.io/docs/postgresql-follower-clusters-scheduled-sync" target="_blank">PostgreSQL</a> in our help docs!</p>
<p style="text-align: justify; padding-bottom: 20px;">If you are unsure about whether follower clusters are the correct solution for your use case, leave a comment or reach us at <a style="color: #2da964;" href="mailto:support@scalegrid.io" target="_blank">support@scalegrid.io</a> - we are happy to discuss which feature best fits your requirements.</p>