xxxxxxxxxx
// Lock The FileSytem
// https://docs.mongodb.com/manual/reference/method/db.fsyncLock/
db.fsyncLock()
// then zip the data directory, your data directory might be different
// compressing may take a long time, so just zip it
tar -cvf ~/mongo-backup.tar /var/lib/mongodb
// Then release the filesystem lock
db.fsyncUnlock()
xxxxxxxxxx
mongodump --host=mongodb1.example.net --port=3017 --username=user --password="pass" --out=/opt/backup/mongodump-2013-10-24