openssl rand -base64 741 > mongo_key
chmod 700 mongo_key
onwer chown mongodb:nogroup mongo_key
master = true keyFile = /path/to/mongo_key
slave = true source = <ip of master> only = bookstore keyFile = /usr/local/bookstore/mongo_key
use admin
db.runCommand( { resync: 1 } )
> use admin
switched to db admin
> db.addUser("root","zhuima")
WARNING: The 'addUser' shell helper is DEPRECATED. Please use 'createUser' instead
Successfully added user: { "user" : "root", "roles" : [ "root" ] }
> use local
switched to db local
> db.addUser("repl","zhuima")
WARNING: The 'addUser' shell helper is DEPRECATED. Please use 'createUser' instead
Successfully added user: { "user" : "repl", "roles" : [ "dbOwner" ] }
[root@redis ~]# sed -e '/^$/d;/^#/d' /etc/mongodb.conf bind_ip = 192.168.58.30 port = 27017 fork = true pidfilepath = /var/run/mongodb/mongodb.pid logpath = /var/log/mongodb/mongodb.log dbpath =/mydata/data journal = true auth = true# 开启认证模式 master = true # 指定该mongodb为master模式
[root@localhost ~]$ sed -e '/^$/d;/^#/d' /etc/mongodb.conf bind_ip = 192.168.58.10 port = 27017 fork = true pidfilepath = /var/run/mongodb/mongodb.pid logpath = /var/log/mongodb/mongodb.log dbpath = /mydata/data journal = true auth = true # 开启认证模式 slave = true # 指定该mongodb为slave模式 source = 192.168.58.30:27017 # 指定master服务器
> db.printReplicationInfo() this is a slave, printing slave replication info. source: 192.168.58.30:27017 syncedTo: Fri Jul 18 2014 10:22:31 GMT+0200 (CEST) = 22 secs ago (0.01hrs) # 这个是指延迟时长
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有