Backups
On this page
Overview
Use the BACKUP DATABASE command to create database backups to cloud storage or the local filesystem.
Prerequisites
-
The
BACKUPprivilege on the database(s) to back up. -
The
OUTBOUNDprivilege at the cluster level (required for cloud destinations). -
Network access from all cluster nodes to the backup destination.
-
Valid credentials for your storage provider for cloud storage.
Backup Destinations
S3-Compatible Object Storage
Store backups in an S3-compatible object storage service (for example, MinIO and Wasabi), specify the endpoint_ configuration option in the following command:
BACKUP DATABASE mydb TO S3 "my-bucket/backups/mydb"CONFIG '{"endpoint_url": "http://minio.example.com:9000","region": "us-east-1"}'CREDENTIALS '{"aws_access_key_id": "minio_access_key","aws_secret_access_key": "minio_secret_key"}';
When you back up to S3-compatible object storage, the credentials specified in the BACKUP DATABASE statement control write access.
Local Filesystem
Store backups on a local or shared filesystem using the following command:
BACKUP DATABASE mydb TO "/mnt/nfs/backups/mydb";
Ensure that all cluster nodes (aggregators and leaves) have write access to the backup path.
Mount a shared filesystem, such as NFS, to the same path on every node.memsql OS user has write permissions on the mount.
# Example: Verify the mount and permissions on each node.mount | grep /backupsls -ld /backups/ # Should show write permission for the memsql user.
Incremental Backups
Incremental backups reduce storage usage and backup duration by only capturing changes since the last full backup.
-
Create the initial baseline backup using
WITH INIT:BACKUP DATABASE mydb WITH INIT TO S3 "my-bucket/backups/mydb_weekly"CONFIG '{"region": "us-east-1"}'CREDENTIALS '{"aws_access_key_id": "your_access_key_id","aws_secret_access_key": "your_secret_access_key"}'; -
Create subsequent differential backups using
WITH DIFFERENTIAL:BACKUP DATABASE mydb WITH DIFFERENTIAL TO S3 "my-bucket/backups/mydb_weekly"CONFIG '{"region": "us-east-1"}'CREDENTIALS '{"aws_access_key_id": "your_access_key_id","aws_secret_access_key": "your_secret_access_key"}';
The differential backup must target the same path as the initial backup.
Note
Incremental backups apply only to columnstore tables.
Schedule Backups with cron
Use a cron job to schedule regular backups.
Toolbox
The following example schedules a weekly full backup, an initial incremental backup, and differential backups using the sdb-admin create-backup command:
# Full backup every Sunday at 2:00 AM0 2 * * 0 sdb-admin create-backup mydb -r "s3://my-bucket/backups/mydb?region=us-east-1" --backup-type full >> /var/log/singlestore-backup.log 2>&1# Initial incremental backup every Monday at 2:00 AM0 2 * * 1 sdb-admin create-backup mydb -r "s3://my-bucket/backups/mydb_incremental?region=us-east-1" --backup-type init --backup-suffix weekly >> /var/log/singlestore-backup.log 2>&1# Differential backups Tuesday through Saturday at 2:00 AM0 2 * * 2-6 sdb-admin create-backup mydb -r "s3://my-bucket/backups/mydb_incremental?region=us-east-1" --backup-type differential --backup-suffix weekly >> /var/log/singlestore-backup.log 2>&1
Refer to sdb-admin create-backup for more information.
Use the singlestore Client
Schedule backups by running the BACKUP DATABASE statement from the singlestore client:
# Daily full backup at 2:00 AM0 2 * * * singlestore -u admin -p'your_password' -e "BACKUP DATABASE mydb TO S3 'my-bucket/backups/mydb/$(date +\%Y-\%m-\%d)' CONFIG '{\"region\":\"us-east-1\"}' CREDENTIALS '{\"aws_access_key_id\":\"...\",\"aws_secret_access_key\":\"...\"}'" >> /var/log/singlestore-backup.log 2>&1
Refer to SingleStore Client for more information.
Schedule Backups with a Kubernetes CronJob
For Kubernetes deployments, use a CronJob to schedule backups with the singlestore/tools image.
The following example schedules a full backup every day at 2:00 AM to an S3-compatible object store:
apiVersion: batch/v1kind: CronJobmetadata:name: singlestore-backupspec:schedule: "0 2 * * *"jobTemplate:spec:template:spec:serviceAccountName: toolscontainers:- name: backupimage: singlestore/tools:alma-v1.11.6-1.17.2imagePullPolicy: IfNotPresentcommand:- sdb-admin- create-backup- mydb- -r- "s3://my-bucket/backups/mydb?region=us-east-1"- --backup-type- full- -c- /etc/memsql/toolbox-config.hcl- --yesvolumeMounts:- name: toolbox-configmountPath: /etc/memsqlreadOnly: truevolumes:- name: toolbox-configsecret:secretName: singlestore-toolbox-configrestartPolicy: NeverbackoffLimit: 2
Store the database credentials in a Kubernetes Secret:
apiVersion: v1kind: Secretmetadata:name: backup-credstype: Opaquedata:user: <base64-encoded-username>password: <base64-encoded-password>
To schedule differential backups, create a second CronJob that runs on a different schedule and specifies --backup-type differential.
Refer to sdb-admin create-backup for the complete list of backup options.
Restore a Backup
Use the RESTORE DATABASE command to restore a database from S3-compatible object storage.
Before you restore a backup:
-
Make sure the cluster can reach the backup location and has any required storage credentials.
-
Use the same backup path that was used when the backup was created.
A common restore error is specifying the wrong path. -
SingleStore does not support restoring a backup created on a newer version into an older version.
Restore from S3-compatible Object Storage
If a database was backed up to S3-compatible object storage, restore it from the same bucket and path and provide the required configuration and credentials:
RESTORE DATABASE mydbFROM S3 "my-bucket/backups/mydb"CONFIG '{"region": "us-east-1"}'CREDENTIALS '{"aws_access_key_id": "your_access_key_id","aws_secret_access_key": "your_secret_access_key"}';
For S3-compatible providers, use the same connection details that were used for the backup, including any required endpoint configuration.
Restore from a Local or Shared Filesystem
If a database was backed up to a local or shared filesystem, restore it from the same path:
RESTORE DATABASE mydb FROM "/mnt/nfs/backups/mydb";
Make sure the restore path points to the backup you want to recover and is accessible from the cluster nodes.
Restore a Differential Backup Set
If the backup path contains an initial backup and a later differential backup, restore from that same path.
Verify the Restored Database
After the restore finishes, verify that the restored database is usable:
-
Confirm that the database is back online and that you can connect to it.
-
Confirm that the expected tables are present.
-
Test restore procedures regularly as part of your backup process.
Monitoring Backups
Query the information_ view to verify backup status:
SELECT database_name, backup_id, status, start_timestamp, end_timestampFROM information_schema.MV_BACKUP_HISTORYORDER BY start_timestamp DESCLIMIT 10;
+------------------+-----------+---------+---------------------+---------------------+
| database_name | backup_id | status | start_timestamp | end_timestamp |
+------------------+-----------+---------+---------------------+---------------------+
| test_db | 11003 | Success | 2026-04-18 18:00:08 | 2026-04-18 18:00:10 |
| memsql_example | 11002 | Success | 2026-04-18 18:00:06 | 2026-04-18 18:00:08 |
| s2examples | 11001 | Success | 2026-04-18 18:00:04 | 2026-04-18 18:00:06 |
| agentdb | 11000 | Success | 2026-04-18 18:00:01 | 2026-04-18 18:00:04 |
| test_db | 10003 | Success | 2026-04-11 18:00:08 | 2026-04-11 18:00:09 |
| memsql_example | 10002 | Success | 2026-04-11 18:00:06 | 2026-04-11 18:00:07 |
| s2examples | 10001 | Success | 2026-04-11 18:00:03 | 2026-04-11 18:00:05 |
| agentdb | 10000 | Success | 2026-04-11 18:00:01 | 2026-04-11 18:00:03 |
| test_db | 9003 | Success | 2026-04-04 18:00:07 | 2026-04-04 18:00:09 |
| memsql_example | 9002 | Success | 2026-04-04 18:00:05 | 2026-04-04 18:00:07 |
+------------------+-----------+---------+---------------------+---------------------+Best Practices
-
Rotate backup paths: Include a date or timestamp in the backup path to avoid overwriting previous backups.
-
Test restores regularly: Verify that backups can be restored successfully with
RESTORE DATABASE. -
Use incremental backups for large databases: Reduces backup time and storage for columnstore-heavy workloads.
-
Secure credentials: Store backup credentials in environment variables or a secrets manager rather than hardcoding them in scripts.
-
Monitor for failures: Check
MV_or parse theBACKUP_ HISTORY cronlog output for backup failures.
Last modified: