【MongoDB学习笔记33】MongoDB副本集rs辅助函数-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

【MongoDB学习笔记33】MongoDB副本集rs辅助函数

rs是一个全局的变量,其中那个包含与复制相关的辅助函数,这些函数大多只是数据库命令的包装器,例如

为企业提供网站建设、网站设计、网站优化、成都营销网站建设、竞价托管、品牌运营等营销获客服务。成都创新互联拥有网络营销运营团队,以丰富的互联网营销经验助力企业精准获客,真正落地解决中小企业营销获客难题,做到“让获客更简单”。自创立至今,成功用技术实力解决了企业“网站建设、网络品牌塑造、网络营销”三大难题,同时降低了营销成本,提高了有效客户转化率,获得了众多企业客户的高度认可!

>db.adminCommand({“replSetInitiate”:config})

就和

>rs.initiate(config)

命令是等价的,但是明显后者更容易操作;多了解一下辅助函数还是比较利于操作的。

执行rs.help()可查看可用的辅助函数,如下:

spock:PRIMARY> rs.help()           
rs.status()    { replSetGetStatus : 1 } checks repl set status            
rs.initiate()    { replSetInitiate : null } initiates set with default settings     
rs.initiate(cfg)  { replSetInitiate : cfg } initiates set with configuration cfg   
rs.conf()      get the current configuration object from local.system.replset 
rs.reconfig(cfg)  updates the configuration of a running replica set with cfg (disconnects)            
rs.add(hostportstr) add a new member to the set with default attributes (disconnects) 
rs.add(membercfgobj) add a new member to the set with extra attributes (disconnects)   
rs.addArb(hostportstr)   add a new member which is arbiterOnly:true (disconnects)   
rs.stepDown([secs])   step down as primary (momentarily) (disconnects)         
rs.syncFrom(hostportstr)        make a secondary to sync from the given member  
rs.freeze(secs)    make a node ineligible to become primary for the time specified 
rs.remove(hostportstr) remove a host from the replica set (disconnects)      
rs.slaveOk()      shorthand for db.getMongo().setSlaveOk()
rs.printReplicationInfo()  check oplog size and time range           
rs.printSlaveReplicationInfo()  check replica set members and replication lag     
db.isMaster()                   check who is primary
reconfiguration helpers disconnect from the database so the shell will display an error, even if the command succeeds.            
see also http://:28017/_replSet for additional diagnostic info


本文标题:【MongoDB学习笔记33】MongoDB副本集rs辅助函数
本文URL:http://kswsj.cn/article/jpsddj.html

其他资讯