Navigation
This version of the documentation is archived and no longer supported.

rs.initiate()

rs.initiate(configuration)
Parameters:
  • configuration – Optional. A document that specifies the configuration of a replica set. If not specified, MongoDB will use a default configuration.

Initiates a replica set. Optionally takes a configuration argument in the form of a document that holds the configuration of a replica set. Consider the following model of the most basic configuration for a 3-member replica set:

{
    _id : <setname>,
     members : [
         {_id : 0, host : <host0>},
         {_id : 1, host : <host1>},
         {_id : 2, host : <host2>},
     ]
}

This function provides a wrapper around the “replSetInitiatedatabase command.

←   rs.help() rs.reconfig()  →