You are viewing an older version of this section. View current production version.
Back up data to a binary file.
BACKUP [DATABASE] db_name TO "backup_path"
db_nameis the name of a MemSQL database.
BACKUPcommand writes a consistent snapshot of the database to disk. This means a backup stores the data in the database as it existed at the time the
BACKUPoperation started (all committed transactions at the time the
BACKUPstarted will be stored in the backup).
BACKUPis an online operation, which means that writes will continue to run while the
BACKUPis in progress. Any writes executed after the
BACKUPhas started will not be reflected in the stored backup.
- All partitions of the database need to be in the online or replicating state to run a
BACKUPoperation. The backup file is created on the server and not the client, unlike
backup_pathis specified relative to
- This command must be run on the master aggregator node (see Node Requirements for MemSQL Commands). The master aggregator needs to briefly block new queries from running across the cluster to start a
BACKUPrunning. Once the
BACKUPis running queries can run against the cluster normally. If there is a long running query executing at the time a
BACKUPoperation is run the
BACKUPwill block and wait for it to finish.
- The easiest way to
RESTOREdatabases is using a network file system (NFS) mounted on every node in the cluster as described here: Backing Up and Restoring Data.
This MemSQL feature is only available in MemSQL Enterprise Edition. MemSQL Enterprise Edition includes 24x7 support and several enterprise-only features for critical deployments. For more information about MemSQL Community and MemSQL Enterprise, see the MemSQL Editions page.
The following example creates a backup on each node in the
mysql> BACKUP DATABASE memsql_demo to "./"; Query OK, 1 row affected (6.32 sec)