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
,database
will be ignored.host
- MongoDB server host, default:127.0.0.1
port
- MongoDB server port, default:27017
socket
- MongoDB server, if use socket, for example:/tmp/mongodb-27017.sock
, default: ``database
- database nameusername
- default: ``, keep empty can use empty password.password
authdb
- authenticationDatabase arg ormongodump
oplog
- oplog arg ormongodump
, default:false
exclude_tables
- Array of collections to exclude from backup, default:[]
args
- Additional options formongodump
utility, 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