Created
July 8, 2019 23:45
-
-
Save joeangel/d0a12ff4253758a7f99c2a8b641b24ef to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| dbs="admin dbname1 dbname2" | |
| user=admin | |
| password=your-password | |
| host=localhost:27017 | |
| i=0 | |
| for db in $dbs; do | |
| echo [MongoDB] backup db: $db | |
| mongodump -u ${user} -p ${password} --host ${host} --db ${db} | |
| ## use authenticationDatabase and ssl | |
| #mongodump -u ${user} -p ${password} --host ${host} --db ${db} --authenticationDatabase=admin --ssl --sslAllowInvalidCertificates | |
| ((i++)) | |
| echo [MongoDB][] processed: ${i} | |
| echo | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment