"MongoDB Learning Note 33" MongoDB replica set RS helper function

Source: Internet
Author: User

RS is a global variable that contains auxiliary functions related to replication, most of which are simply wrappers for database commands, such as

>db.admincommand ({"replsetinitiate": config})

Just and

>rs.initiate (config)

Commands are equivalent, but obviously the latter is easier to manipulate; it's better to know more about auxiliary functions.

Perform rs.help () to see the available auxiliary functions, as follows:

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  primaryreconfiguration helpers disconnect from the database so the  shell will display an error, even if the command succeeds.             see also http://<mongod_host >:28017/_replset for additionAl diagnostic info 



This article is from the "Margin with Wish" blog, please be sure to keep this source http://281816327.blog.51cto.com/907015/1611295

"MongoDB Learning Note 33" MongoDB replica set RS helper function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.