- locate your mongo configuration file
locate mongod.conf
# ubuntu 16.x default install
# /etc/mongod.conf
# /etc/init/mongod.conf
redhat
# find / -name mongod.conf
/etc/mongod.conf
/tmp/mongod.conf
- locate Mongo DB storage folder
grep -i dbpath /etc/mongod.conf
# dbPath: /var/lib/mongodb
- dump
lxHive
database into the storage folder
#### extra args
# --username= <NAME>
# --password=<PASSWORD>
# --port=3017
# --gzip
cd /<path/to/lxHive> && mongodump --verbose --db=<DB NAME> --out=~/mongodump/$(date +%Y-%m-%d.%H:%M:%S)
- restore
lxHive
database into the storage folder
cd ~/mongodump/<date>
mongorestore --db <DB NAME> --verbose ./<FOLDER>
basic lxHive Mongo Cheatsheets