mongodb 配置&备份mongod -f //home/wyd/MongoDB/conf/mongod.conf -v –dbpath /home/wyd/MongoDB/shard-a-primary –logpa…
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
代码100分
代码100分db.createUser( {user: "myUserAdmin", pwd: "abc123", roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] })
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/7707.html