dump
On this page
Description
Generates a sequence of SQL statements that can be executed to reproduce the objects defined in the cluster.dump
.
It creates a backup of only the metadata without the data.roles
, users
, groups
, resource-pools
, databases
, tables
, views
, procedures
, functions
, aggregates
, and pipelines
.
When --databases
flag is used, databases
, tables
, views
, procedures
, functions
, aggregates
, and pipelines
will only be dumped for the specified databases.
Examples
sdb-admin dump --exclude users,roles, groups --output-path dump.sql
sdb-admin dump --only databases,tables,procedures --databases db1,db2
Dumping Data in SQL Format
The dump
command produces a sequence of DDL statements, which can be used to reproduce the objects defined in the original SingleStore database or the cluster.
You can run the dump
command cluster-wide to dump a variety of object types, such as Users, Groups, Roles, and Resource Pools.
Note: The dump
command only creates a backup of the DDL statements in the database.
User Privilege Requirements
The privileges required to create and reload a dump file follow the same pattern of permissions and scope used to read and manipulate each object type individually.
You need the SHOW METADATA
permission to export all object types.SHOW
command for each object type will be sufficient for the export action as well.
Invoking the Dump Command
The following dump
command can be invoked at the command line from inside the directory where Toolbox is installed.
sdb-admin dump
This command can be used with the flags specified in the Usage section.sdb-admin dump --help
.
Using the flags supported by the sdb-admin dump
command, you can dump DDL for objects in one or more databases or an entire cluster.
Flags |
Description |
---|---|
--only resource-pools,databases,tables |
Resource Pools, all |
--databases db1 |
All Resource Pools, Users, Groups, and Roles are dumped. |
--only resource-pools,databases,tables --databases db1 |
Resource-pools, |
--exclude resource-pools,groups,roles --databases db1 |
All the users are dumped. |
Note:
-
To dump an entire cluster, use no flags.
This will export all object types supported, and the output will be written to the default file path or the one specified in the --output-path
flag.However, system databases and views such as information_
,schema cluster
, andmemsql
will not be dumped. -
To dump select databases, specify the required databases via the
--database
flag.You can further filter this output by specifying the necessary object types in the --only
flag.Alternatively, you can ignore certain object types in the output using the --exclude
flag. -
The
--only
and the--exclude
flags allow you to export specific object types on the cluster as well as the database level.Note that these flags cannot be used together.
Reloading the Database Dump
You can reload the dump file into a SingleStore cluster by using a SQL client, such as the MySQL client or the SingleStore Client.
Usage
Usage:
sdb-admin dump [flags]
For flags that can accept multiple values (indicated by VALUES after the name of the flag),
separate each value with a comma.
Flags:
--databases VALUES Only run for specified databases
--exclude VALUES Exclude the specified objects
-h, --help Help for dump
--only VALUES Only dump specified objects
--output-path ABSOLUTE_PATH Write the dump file to this path
Global Flags:
--backup-cache FILE_PATH File path for the backup cache
--cache-file FILE_PATH File path for the Toolbox node cache
-c, --config FILE_PATH File path for the Toolbox configuration
--disable-colors Disable color output in console, which some terminal sessions/environments may have difficulty with
--disable-spinner Disable the progress spinner, which some terminal sessions/environments may have issues with
-j, --json Enable JSON output
--parallelism POSITIVE_INTEGER Maximum number of operations to run in parallel
--runtime-dir DIRECTORY_PATH Where to store Toolbox runtime data
--ssh-control-persist SECONDS Enable SSH ControlPersist and set it to the specified duration in seconds
--ssh-max-sessions POSITIVE_INTEGER Maximum number of SSH sessions to open per host, must be at least 3
--ssh-strict-host-key-checking Enable strict host key checking for SSH connections
--ssh-user-known-hosts-file FILE_PATH Path to the user known_hosts file for SSH connections. If not set, /dev/null will be used
--state-file FILE_PATH Toolbox state file path
-v, --verbosity count Increase logging verbosity: valid values are 1, 2, 3. Usage -v=count or --verbosity=count
-y, --yes Enable non-interactive mode and assume the user would like to move forward with the proposed actions by default
Remarks
This command is interactive unless you use either --yes
or --json
flag to override interactive behavior.
Last modified: July 30, 2024