Contents
How to restore a MongoDB sharded cluster from a backup?
In the case of MongoDB sharded clusters, the official documentation covers the procedure to restore a sharded cluster from a backup. But what if we want to restore the dataset to different hosts, and also rename the shards and/or replicasets? There are some mentions of metadata renaming in the documentation, but the steps are not complete.
How to restore a MongoDB database on a different host?
Create a directory on the target host for the restored database files. Ensure that the user that runs the mongod has read, write, and execute permissions for all files and subfolders in that directory: Substitute /path/to/mongodb with the path to the data directory you created.
Can a mongod restore from a cold backup?
However, if you restore from files taken via “cold” backup (i.e. the mongod is not running), MongoDB cannot detect “dirty” keys on startup, and reuse of IV voids confidentiality and integrity guarantees.
Is there a way to restore a sharded cluster?
This procedure restores a sharded cluster from an existing backup snapshot, such as LVM snapshots. The source and target sharded cluster must have the same number of shards. For information on creating LVM snapshots for all components of a sharded cluster, see Back Up a Sharded Cluster with File System Snapshots.
What is the purpose of sharding in MongoDB?
Sharding is a method for distributing data across multiple machines. MongoDB uses sharding to support deployments with very large data sets and high throughput operations.
What does Percona backup do for MongoDB cluster?
Percona Backup for MongoDB is designed to give you an easy command-line interface to perform a consistent backup/restore of clusters and non-sharded replica sets. It uses S3 (or S3-compatible) object storage for the remote store.
Can a client connect to more than one shard in Mongo?
Clients should never connect to a single shard in order to perform read or write operations. You can connect to a mongos the same way you connect to a mongod, such as via the mongo shell or a MongoDB driver. MongoDB supports two sharding strategies for distributing data across sharded clusters.