MongoDB
GoBackup uses mongodump utility to backup MongoDB database files.
Install tool
Config keys
type: mongodb
uri- MongoDB connection URI, for example:mongodb://root:root@localhost:27017/my_app_production?authSource=admin, if you have present this, thenhost,port,username,password,databasewill be ignored.host- MongoDB server host, default:127.0.0.1port- MongoDB server port, default:27017socket- MongoDB server, if use socket, for example:/tmp/mongodb-27017.sock, default: ``database- database nameusername- default: ``, keep empty can use empty password.passwordauthdb- authenticationDatabase arg ormongodumpoplog- oplog arg ormongodump, default:falseexclude_tables- Array of collections to exclude from backup, default:[]args- Additional options formongodumputility, for example:--gzip --dumpDbUsersAndRoles
https://github.com/huacnlee/gobackup/blob/master/database/mongodb.go (opens in a new tab)
Example
models:
my_app:
databases:
my_app:
type: mongodb
host: 127.0.0.1
port: 27017
database: my_app_production
username: root
password: root
oplog: true
exclude_tables:
- collection1
- collection2
args: --gzip --dumpDbUsersAndRoles