Skip to content

Commit 0533411

Browse files
Merge pull request #61 from kanchana-mongodb/DOCSP-12664
DOCSP-12664 Replica Set Management methods
2 parents 971978a + 158b9b6 commit 0533411

File tree

1 file changed

+65
-46
lines changed

1 file changed

+65
-46
lines changed

source/reference/methods.txt

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -887,16 +887,55 @@ 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. The
904+
duration must be specified in seconds.
905+
906+
* - :method:`db.getReplicationInfo()`
907+
908+
- Returns the status of the replica set from the oplog data.
909+
910+
* - ``rs.isMaster``
911+
912+
- Returns the replica set configuration, role, and status for
913+
the ``mongod`` instance that ``mongosh`` is connected to.
914+
915+
The ``mongosh`` ``rs.isMaster()`` method wraps the server :dbcommand:`isMaster` command.
916+
917+
* - :method:`db.printReplicationInfo()`
918+
919+
- Returns the oplog of the replica set member that ``mongosh`` is
920+
connected to.
921+
922+
This is identical to the :method:`rs.printReplicationInfo()` method.
923+
924+
* - :method:`rs.printReplicationInfo()`
925+
926+
- Returns the oplog of the replica set member that ``mongosh`` is
927+
connected to.
928+
929+
This is identical to the :method:`db.printReplicationInfo()` method.
930+
931+
* - ``db.printSecondaryReplicationInfo``
892932

893933
- Returns the status of the secondary members of the replica set.
894934

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.
935+
This is identical to the ``rs.printSecondaryReplicationInfo()`` method.
936+
This method's output is similar to the
937+
:method:`db.printSlaveReplicationInfo()` method. The :method:`db.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
938+
``db.printSecondaryReplicationInfo()`` instead.
900939

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

907946
source: rs2.example.net:27017
908947
{
909-
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
948+
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
910949
replLag: '0 secs (0 hrs) behind the primary '
911950
}
912951
---
913952
source: rs3.example.net:27017
914953
{
915-
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
954+
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
916955
replLag: '0 secs (0 hrs) behind the primary '
917956
}
918957

919-
* - ``db.printSecondaryReplicationInfo``
958+
* - ``rs.printSecondaryReplicationInfo``
920959

921960
- Returns the status of the secondary members of the replica set.
922961

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.
962+
This is identical to the ``db.printSecondaryReplicationInfo()``
963+
method. This method's output is similar to the
964+
:method:`rs.printSlaveReplicationInfo()` method in the legacy
965+
:binary:`~mongo` shell. The :method:`rs.printSlaveReplicationInfo()` method is deprecated in ``mongosh``. Use
966+
``rs.printSecondaryReplicationInfo()`` instead.
927967

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

934974
source: rs2.example.net:27017
935975
{
936-
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
976+
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
937977
replLag: '0 secs (0 hrs) behind the primary '
938978
}
939979
---
940980
source: rs3.example.net:27017
941981
{
942-
syncedTo: 'Tue Oct 13 2020 09:37:28 GMT-0700 (Pacific Daylight Time)',
982+
syncedTo: 'Tue Oct 13 2020 09:42:18 GMT-0700 (Pacific Daylight Time)',
943983
replLag: '0 secs (0 hrs) behind the primary '
944984
}
945985

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()`
986+
* - :method:`rs.remove()`
965987

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.
988+
- Removes the member specified by hostname from the replica set.
970989

971990
* - :method:`rs.status()`
972991

973992
- Returns the status of the replica set member that ``mongosh`` is
974993
connected to.
975-
* - :method:`rs.add()`
976994

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

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

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

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

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

0 commit comments

Comments
 (0)