Backup a Small Sharded Cluster with
If your sharded cluster holds a small data set, you can
connect to a
mongodump. You can
create backups of your MongoDB cluster, if your backup infrastructure
can capture the entire backup in a reasonable amount of time and if
you have a storage system that can hold the complete MongoDB data set.
mongodump issue its queries to
the non-primary nodes.
You cannot use the
--oplog option for
mongodump when capturing data from
mongos. As a result, if you need to capture a backup that
reflects a single moment in time, you must stop all writes to the
cluster for the duration of the backup operation.
mongodump against a MongoDB deployment that has
access control enabled, you must have
privileges that grant
find action for each database to
back up. The built-in
backup role provides the required
privileges to perform backup of any and all databases.
mongodump --host mongos3.example.net --port 27017
Backups created with
mongodump do not reflect the chunks or
the distribution of data in the sharded collection or
collections. Like all
mongodump output, these backups
contain separate directories for each database and BSON files
for each collection in that database.
You can restore
mongodump output to any MongoDB instance,
including a standalone, a replica set, or a new
sharded cluster. When restoring data to sharded cluster, you
must deploy and configure sharding before restoring data from the
backup. See Deploy a Sharded Cluster for more information.