Skip to content

Instantly share code, notes, and snippets.

@fortunto2
Created September 10, 2021 21:53
Show Gist options
  • Save fortunto2/680b1526bfd7e5229312a4e2bc8a91fe to your computer and use it in GitHub Desktop.
Save fortunto2/680b1526bfd7e5229312a4e2bc8a91fe to your computer and use it in GitHub Desktop.
mongodump --host localhost --port 27017 --username root --password XXXX --authenticationDatabase admin -d XXXX --gzip --archive > dump_`date "+%Y-%m-%d"`.gz
mongorestore --archive="mongodump-test-db" --nsFrom='test.*' --nsTo='examples.*'
#### build mongo dumper
git clone https://github.com/mongodb/mongo-tools
cd mongo-tools
sudo apt-get install -y libkrb5-dev
./make build -tools=mongodump,mongorestore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment