Replicate an Unlimited Storage Database
On this page
Note
Unlimited storage databases are not available in all editions of SingleStore.
Replicating an unlimited storage database allows you to recover from a disaster when the database at the primary site is unavailable forever, or for a long time.
SingleStore does not have built-in functionality to replicate an unlimited storage database.
Replication Procedure
The following example demonstrates how to replicate an unlimited storage database, where Amazon S3 is used as the object store.
The replication of blobs by the object store should happen in the correct sequence.
Setup
1.bottomless_
in the object storage bucket bottomless_
in the folder bottomless_
.
The following definition assumes you are using Amazon S3 as the object storage provider.
Note that aws_
is required only if your credentials in the CREDENTIALS
clause are temporary.
CREATE DATABASE bottomless_db ON S3 "bottomless_db_bucket/bottomless_db_folder"CONFIG '{"region":"us-east-1"}'CREDENTIALS '{"aws_access_key_id":"your_access_key_id","aws_secret_access_key":"your_secret_access_key","aws_session_token":"your_session_token"}';
The following definition assumes you are using Azure as the object storage provider.
CREATE DATABASE bottomless_db ON AZURE "bottomless_db_bucket/bottomless_db_folder"CONFIG ''CREDENTIALS '{"account_name":"your_account_name","account_key":"your_account_key"}';
The following definition assumes you are using GCS as the object storage provider.
CREATE DATABASE bottomless_db ON GCS "bottomless_db_bucket/bottomless_db_folder"CONFIG ''CREDENTIALS'{"access_id":"your_access_key_id", "secret_key":"your_secret_access_key"}';
2.bottomless_
.
USE bottomless_db;CREATE TABLE t(a INT);INSERT INTO t(a) VALUES (10);INSERT INTO t(a) VALUES (20);
3.
CREATE MILESTONE "after_second_insert" FOR bottomless_db;
4.bottomless_
:
INSERT INTO t(a) VALUES (30);INSERT INTO t(a) VALUES (40);
Replication Steps
In remote object storage, create a new bucket replicated_
where you will replicate the objects from bottomless_
.
Next, replicate the bottomless_
folder in the bottomless_
to the replicated_
.
Suppose that bottomless_
is no longer accessible and you want to failover to replicated_
.<root-path>/<storage-id>/storage_
.<number>_
for some pair of numbers.
After stopping the replication, attach replicated_
to bottomless_
.AT MILESTONE
or AT TIME
, the database will be attached at the point in time containing the latest update to the source database.
ATTACH DATABASE bottomless_db ON S3 "replicated_bottomless_db_bucket/bottomless_db"CONFIG '{"region":"us-east-1"}'CREDENTIALS '{"aws_access_key_id":"your_access_key_id","aws_secret_access_key":"your_secret_access_key"}';
Caution
Replication must be stopped before the destination database can be attached with objects in the destination bucket.
Last modified: January 3, 2022