java wrapper for mongodump and mongorestore
MIT License
A simple java wrapper for mongodb backup commands : mongodump & mongorestore
Goal is to provide to any java application, a simple and light way to backup a Mongo database:
Add in your pom
<dependency>
<groupId>com.github.boly38</groupId>
<artifactId>mongodbdump-java-wrapper</artifactId>
<version>1.4</version>
</dependency>
Under bash-like console, you could execute _wrapper.sh
.
Otherwise, launch the following command:
java -Dlog4j.configuration=file:log4j.properties -jar target/mongodbdump-java-wrapper-1.4.jar -h
subscribe and login onto dropbox.com
create your dropbox application for your backup (example : MongoWrapper)
configure your environment to use dropbox service: (mandatory) a dropbox access TOKEN of your app plus an optional application name. Example :
DROPBOX_TOKEN="MYWONDERFULLTOKEN_HERE_FROM_DROPBOX_APP_INFO" DROPBOX_APPLICATION="MyWrapper"
example of backup:
MongoServerHostConfiguration hostConf = new MongoServerHostConfiguration();
MongodumpService mService = MongodumpService.getInstance(hostConf);
BackupConfiguration backupConf = BackupConfiguration.getInstance("myDatabase", "myBackup");
String backupLocalZipFile = mService.backup(backupConf);
Integration tests are good way to know how to use this library. Each main feature is described with a dedicated integration test.
###MongodumpServiceITest
###DropboxMongoBackupServiceITest
This project is hosted by Sonatype.org : oss.sonatype.org
Contributions are welcome through feature branch and pull request.
If you encounter issue, please provide details on a new ticket.