mongodb配置&备份
mongod -f //home/wyd/MongoDB/conf/mongod.conf -v --dbpath /home/wyd/MongoDB/shard-a-primary --logpath /home/wyd/MongoDB/log/shard-a-primary.log --pidfilepath /home/wyd/MongoDB/pid/shard-a-primary.pid --port 27017
=============================================
cat /home/wyd/MongoDB/conf/mongod.conf
systemLog:
destination: file
logAppend: true
storage:
journal:
enabled: true
directoryPerDB: true
engine: wiredTiger
wiredTiger:
engineConfig:
cacheSizeGB: 30
directoryForIndexes: true
indexConfig:
prefixCompression: true
processManagement:
fork: true
net:
port : 27017
bindIp : 0.0.0.0
=========================================
导出数据:${mdbdir}/mongodump -u ${user} -p ${pass} --host ${ip} --port ${hostport} --authenticationDatabase=admin --oplog --out ${bakdir}/$1_${nowtime}
-d dbname
--forceTableScan
mongodump默认使用snapshot,会通过扫描_id 索引,然后去读取实际的文档。TableScan会按照mongodb的物理存储顺序进行扫描,没有读取index的过程。但是tablescan潜在的问题是,如果一个文档在dump的过程中移动了(物理上),有可能会最终输出两次。
#恢复:/data/mongodb/mongos/bin/mongorestore -u ## -p ## --host ## --port ## --authenticationDatabase=admin --drop --oplogReplay --dir=/##/#/full
-d dbname
db.createUser( {user: "myUserAdmin", pwd: "abc123", roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] })
以上是 mongodb配置&备份 的全部内容, 来源链接: utcz.com/z/534316.html