Sync MongoDB Databases in Bash.!
-
Download / Clone the script
git clone https://github.com/laget-se/mongo-sync.git cd mongos
-
Edit
config.yml
and insert your configuration details -
Use the script like this:
./mongos push [options] # Push DB to Destination ./mongos pull [options] # Pull DB from Source ./mongos sync [options] # Pull & Push ./mongos clean [options] # Cleanup, removes all pulled data
-
Options
-y (--yes) # Skip confirmation -c (--config) file.yml # Use alternative config file
mongos
requiresmongodump
andmongorestore
binaries to be installed in your system. If you havemongodb
installed, then you probably already have them- Pushing/Synchronizing overwrites the destination DB
- It's a good idea to keep your alternative/custom
config.yml
in.gitignore
if you're using it inside some other project
- Add a
backup
command and an--auto-backup
feature
- Fork it
- Create your feature/fix branch (
git checkout -b feature/my-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-feature
) - Create a new Pull Request