Skip to content

Commit 9bf09cd

Browse files
DOCSP-12664 Replica Set Management methods
1 parent 971978a commit 9bf09cd

File tree

1 file changed

+64
-46
lines changed

1 file changed

+64
-46
lines changed

source/reference/methods.txt

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -887,16 +887,54 @@ Replication Methods
887887
* - Method
888888

889889
- Description
890-
891-
* - ``rs.printSecondaryReplicationInfo``
890+
891+
* - :method:`rs.add()`
892+
893+
- Adds a member to the replica set. You must connect to the
894+
primary of the replica set to run this method.
895+
896+
* - :method:`rs.addArb()`
897+
898+
- Adds an arbiter to an existing replica set.
899+
900+
* - :method:`rs.freeze()`
901+
902+
- Makes the replica set member that ``mongosh`` is connected to
903+
ineligible to become primary for the specified duration.
904+
905+
* - :method:`db.getReplicationInfo()`
906+
907+
- Returns the status of the replica set from the oplog data.
908+
909+
* - ``rs.isMaster``
910+
911+
- Returns the replica set configuration, role, and status for
912+
the ``mongod`` instance that ``mongosh`` is connected to.
913+
914+
The ``mongosh`` ``rs.isMaster()`` method wraps the server :dbcommand:`isMaster` command.
915+
916+
* - :method:`db.printReplicationInfo()`
917+
918+
- Returns the oplog of the replica set member that ``mongosh`` is
919+
connected to.
920+
921+
This is identical to the :method:`rs.printReplicationInfo()` method.
922+
923+
* - :method:`rs.printReplicationInfo()`
924+
925+
- Returns the oplog of the replica set member that ``mongosh`` is
926+
connected to.
927+
928+
This is identical to the :method:`db.printReplicationInfo()` method.
929+
930+
* - ``db.printSecondaryReplicationInfo``
892931

893932
- Returns the status of the secondary members of the replica set.
894933

895-
This is identical to the ``db.printSecondaryReplicationInfo()``
896-
method. This method's output is similar to the
897-
:method:`rs.printSlaveReplicationInfo()` method in the legacy
898-
:binary:`~mongo` shell. The :method:`rs.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
899-
``rs.printSecondaryReplicationInfo()`` instead.
934+
This is identical to the ``rs.printSecondaryReplicationInfo()`` method.
935+
This method's output is similar to the
936+
:method:`db.printSlaveReplicationInfo()` method. The :method:`db.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
937+
``db.printSecondaryReplicationInfo()`` instead.
900938

901939
The following is an example output from the
902940
``rs.printSecondaryReplicationInfo()`` method issued on a replica set with two secondary members:
@@ -906,24 +944,25 @@ Replication Methods
906944

907945
source: rs2.example.net:27017
908946
{
909-
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
947+
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
910948
replLag: '0 secs (0 hrs) behind the primary '
911949
}
912950
---
913951
source: rs3.example.net:27017
914952
{
915-
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
953+
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
916954
replLag: '0 secs (0 hrs) behind the primary '
917955
}
918956

919-
* - ``db.printSecondaryReplicationInfo``
957+
* - ``rs.printSecondaryReplicationInfo``
920958

921959
- Returns the status of the secondary members of the replica set.
922960

923-
This is identical to the ``rs.printSecondaryReplicationInfo()`` method.
924-
This method's output is similar to the
925-
:method:`db.printSlaveReplicationInfo()` method. The :method:`db.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
926-
``db.printSecondaryReplicationInfo()`` instead.
961+
This is identical to the ``db.printSecondaryReplicationInfo()``
962+
method. This method's output is similar to the
963+
:method:`rs.printSlaveReplicationInfo()` method in the legacy
964+
:binary:`~mongo` shell. The :method:`rs.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
965+
``rs.printSecondaryReplicationInfo()`` instead.
927966

928967
The following is an example output from the
929968
``rs.printSecondaryReplicationInfo()`` method issued on a replica set with two secondary members:
@@ -933,54 +972,33 @@ Replication Methods
933972

934973
source: rs2.example.net:27017
935974
{
936-
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
975+
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
937976
replLag: '0 secs (0 hrs) behind the primary '
938977
}
939978
---
940979
source: rs3.example.net:27017
941980
{
942-
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
981+
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
943982
replLag: '0 secs (0 hrs) behind the primary '
944983
}
945984

946-
* - :method:`db.getReplicationInfo()`
947-
948-
- Returns the status of the replica set from the oplog data.
949-
950-
* - ``rs.isMaster``
951-
952-
- Returns the replica set configuration, role, and status for
953-
the ``mongod`` instance that ``mongosh`` is connected to.
954-
955-
The ``mongosh`` ``rs.isMaster()`` method wraps the server :dbcommand:`isMaster` command.
956-
957-
* - :method:`rs.printReplicationInfo()`
958-
959-
- Returns the oplog of the replica set member that ``mongosh`` is
960-
connected to.
961-
962-
This is identical to the :method:`db.printReplicationInfo()` method.
963-
964-
* - :method:`db.printReplicationInfo()`
985+
* - :method:`rs.remove()`
965986

966-
- Returns the oplog of the replica set member that ``mongosh`` is
967-
connected to.
968-
969-
This is identical to the :method:`rs.printReplicationInfo()` method.
987+
- Removes the member specified by hostname from the replica set.
970988

971989
* - :method:`rs.status()`
972990

973991
- Returns the status of the replica set member that ``mongosh`` is
974992
connected to.
975-
* - :method:`rs.add()`
976993

977-
- Adds a member to the replica set. You must connect to the
978-
primary of the replica set to run this method.
994+
* - :method:`rs.stepDown()`
979995

980-
* - :method:`rs.addArb()`
996+
- Makes the primary of the replica set a secondary. You must be
997+
connected to the primary to run this method.
981998

982-
- Adds an arbiter to an existing replica set.
999+
* - :method:`rs.syncFrom()`
9831000

984-
* - :method:`rs.remove()`
1001+
- Resets the sync target to the replica set member specified
1002+
by hostname for the replica set member that ``mongosh`` is
1003+
connected to.
9851004

986-
- Removes the member specified by hostname from the replica set.

0 commit comments

Comments
 (0)