Skip to content
New

Protect and Recover Production Workloads

Notebook


SingleStore Notebooks

Protect and Recover Production Workloads

Smart Disaster Recovery (DR): Smart DR

Disasters can strike at any moment, whether they are natural or human-caused. When they do, your critical apps need a business continuity strategy to keep running. SingleStore Helios SmartDR is your fully automated disaster recovery (DR) solution, asynchronously replicating your data and configurations to a secondary region with minimal downtime or data loss for critical applications.

The key difference between disaster recovery and high availability

Before we dive into the details, let’s clarify the difference between High Availability(HA) and Disaster Recovery(DR). HA and DR are often used interchangeably, but have distinct purposes. Both aim to maintain the availability of your critical data or application, but HA focuses on preventing or minimizing interruptions from minor glitches or isolated infrastructure events. On the other hand, DR deals with large-scale events and disasters that affect a whole region, and have an unknown resolution time.

For example, some scenarios where HA can help are when the health of compute nodes is degraded, storage volume fails, a network outage affects multiple racks or a power outage shuts down a whole data center (Availability Zone). DR plans come into effect when an entire region fails due to natural disasters — like an earthquake or flood — and we don’t know when it will be back online. In some industries, like FSI or healthcare, it is mandatory to have a strong DR plan that meets certain Recovery Point Objective(RPO) and Recovery Time Objective(RTO) requirements.

SingleStore SmartDR is different

With SingleStore Helios SmartDR, you can achieve a cross-region DR strategy with ease. Not only does SmartDR replicate your data, but also all the cluster configurations, users, roles and permissions, firewall policies, Pipelines (for ingest) and all other metadata. What sets SmartDR apart is that it does not require you to have a duplicate compute running idle all the time on the secondary region — wasting 2x your credits. As you know, compute is the most expensive part of your infrastructure.

Prerequisite: generate the Digital Marketing dataset

The Digital Marketing dataset can be generated using the website here: digital-marketing.labs.singlestore.com

  1. Sign up for SingleStore Helios or Login to the portal if you already have account created. You can use SingleStore couments to get started with Helios platform if need more assistance. Getting Started with SingleStore Helios

  2. Make sure your Standard or Premium cluster is running.

  3. Open the website and fill in the connection form: your cluster host with https:// in front (find it under Connect in the portal), username admin, your cluster password, and database name martech. Click Connect.

  4. Click Setup Database. It creates the martech database and starts streaming shopper locations and purchases into it. Keep the Simulator switch on.

  5. Under Locations, tick the cities you want. Each city adds ad campaigns, so more cities give the notebook more ads to search.

  6. Wait until Ad Campaigns shows a number above 0, then come back here. If the connection fails, check that your cluster's firewall allows your IP address.

The notebook only reads from martech. If you skip this step, it loads the same data from the dataset's public S3 bucket instead.

Setting up Smart DR

Configuring Replication
  1. Go to Clusters from the left nav and select the cluster.

  2. Click the three vertical dots against the selected cluster, and from the drop down list select Configure Smart DR.

  3. Click +Configure Replication, choose the relevant database options and submit.

The Configure Smart DR screen section displays 3 top level menu options:

  1. Clusters displays the clusters name, region and the Failover Role.

  2. Databases displays the replicated databases name and status. Clicking on the Manage button allows you to view the available databases and select them for replication.

  3. Settings displays the Primary Region which is the region where your database(s) currently reside. and the Secondary Region to which you want to replicate the database(s).
    Replication Type which is Storage only by default. This implies the data is copied asynchronously between clusters and the secondary site does not require active compute nodes running.
    Auto-replication is disabled by default. If enabled, new databases are replicated automatically.

Pre-provision your secondary region with SmartDR:

SingleStore also gives you more flexibility to pre-provision your secondary region in advance. This has three main advantages:

  1. Configure the private endpoints for secure connections to your app before initiating failover.

  2. Test DR by failing over to the secondary region without impacting your primary environment.

  3. Pre-provisioning allows you to secure clusters and "beat the rush" that can occur in surviving regions if another region goes down.

If a disaster strikes and you want to fail over, you only have to click a single Failover button. We then provision your environment on demand in the secondary or target region. After the failover is completed, your secondary region will look exactly like the primary (or recently failed) region. At this point, you just need to point your app to the new cluster.

To start the Failover process:

  1. Click the 3 vertical dots against the selected cluster, and from the drop down list select Configure SmartDR.

  2. Click the Failover button on the left upper side of the Configure Smart DR screen. Check the I confirm… checkbox and click Confirm in the popup window. You can monitor the progress from the status bar.

Want to fail back to the primary region? No worries — it’s just one click away!

SingleStore’s unique ability to make sure your object storage data is eventually available in both regions makes failing back to the primary region a breeze. Once you are confident the primary region (Region A) is working 100%, you simply have to navigate to the replication tab in the active secondary region (Region B) and click Failback.

SingleStore will take care of the rest: it configures the infrastructure in Region A, updates users/permissions and other firewall settings, attaches the DBs and presents you with a connection string to connect and resume your application in the primary region (Region A). This failback process is incremental — it is not necessary to copy the whole database from region B back to region A. Only the changes have to be copied back.

To initiate Failback from the secondary region to the primary region:

  1. Click the three vertical dots against the selected cluster, and in the drop down list select Configure Smart DR.

  2. Click the Failback button on the left upper side of the Configure Smart DR screen. Check the I confirm… checkbox and click Confirm in the popup window. You can monitor the progress from the status bar.

Continuous Backups and Restore

Continuous backups asynchronously store all customer data in unlimited storage (bottomless storage) ensuring that every change (inserts, updates, and deletes) is durably persisted with 99.9999% reliability.
With a default 7-day retention period, they allow you to restore your data to a point in time within this window using the always available point-in-time recovery (PITR) option.

Benefits:

  • Continuous backups do not interrupt active jobs and do not impact your workload. Since data is continuously backed up in the background, it does not consume additional CPU resources, unlike full backups.

  • You can restore your data whenever required, without the need to create Support tickets.

  • You can recover your data while your primary database is online.

Enabling Continuous Backups

Connect to your cluster and run the following query to check the value of the bottomless_gc_retention_period_minutes variable:

In [1]:

1%%sql2SELECT @@bottomless_gc_retention_period_minutes;

If the output value is 0 (zero) then Continuous Backups are disabled for the cluster. A non-zero value implies Continuous Backups are enabled. For example, a value of 10080 means backups are enabled with a retention period of 10080 minutes (7 days).

Note:

Enterprise edition has the option to extend this period up to 90 days or longer. To retain your data for extended time periods beyond what is available with continuous backups, you can use the BACKUP DATABASE command to back up your database to your own object storage.

Backup Considerations:
  1. SingleStore cluster cloud take backups against databases attached in Read & Write mode.

  2. Clusters with databases attached in Read Only mode are not backed up as part of the automatic process.

Continuous Backups and PITR

Continuous backups are the always-on history feed into bottomless storage happening in the background, while PITR is the feature that lets you use that available history to restore or branch a database at specific points in time. The restore granularity and available history are governed by your edition and configured retention period.

Let's perform DELETE operation on requests table and do PITR to restore it back.

In [2]:

1%%sql2USE martech;3SELECT COUNT(*) from requests;

In [3]:

1import singlestoredb as s22from prettytable import PrettyTable3
4# Connection comes from the cluster dropdown at the top of the notebook5with s2.connect() as conn:6    with conn.cursor() as cur:7        cur.execute("USE martech")8        cur.execute("SELECT DATABASE()");           db = cur.fetchone()[0]9        cur.execute("SELECT NOW()");                now = cur.fetchone()[0]10        cur.execute("SELECT COUNT(*) FROM requests"); before = cur.fetchone()[0]11        cur.execute("DELETE FROM requests");          deleted = cur.rowcount12        conn.commit()13        cur.execute("SELECT COUNT(*) FROM requests"); after = cur.fetchone()[0]14        cur.execute("SELECT NOW()");                end = cur.fetchone()[0]15
16pt = PrettyTable(['Database', 'Time', 'Before delete', 'Rows deleted', 'After delete', 'End Time'])17pt.add_row([db, now, f"{before:,}", f"{deleted:,}", f"{after:,}", end])18print(pt)

To restore data:

  1. Create a branch of your database by specifying the relevant timestamp.

  2. Use this new branch database to query and restore the data as needed.

In [4]:

1%%sql2## Creating Database Branch using SQL:3ATTACH DATABASE martech AS martech_PITR AT TIME '2026-10-06 20_26_33';

Note:

In the Standard edition, you can create a branch by specifying a specific date. The timestamp of the branch is automatically set to 00:00:00 and cannot be modified.
In the Enterprise edition, the data can be restored to a granularity of 1 second. You must ensure the timestamp is specified in UTC.

In [5]:

1%%sql2USE martech_PITR;3SELECT COUNT(*) from requests;

Clean up

If you wish to retain martech database for future use. Drop existing martech database and rename martech_PITR to martech.

In [6]:

1%%sql2DROP DATABASE IF EXISTS martech;3DETACH DATABASE martech_PITR;4ATTACH DATABASE martech_PITR AS martech;

Details


About this Template

SingleStore Helios SmartDR, continuous backups, and self-service point-in-time recovery.

Tags

See Notebook in action

Launch this notebook in SingleStore and start executing queries instantly.

License

This Notebook has been released under the Apache 2.0 open source license.