@@ -10,19 +10,11 @@ Change the Size of the Oplog
10
10
:depth: 1
11
11
:class: singlecol
12
12
13
- .. versionadded:: 3.6
14
-
15
13
This procedure changes the size of the oplog [#oplog]_ on each member of a
16
14
replica set using the :dbcommand:`replSetResizeOplog` command, starting
17
15
with the :term:`secondary` members before proceeding to the
18
16
:term:`primary`.
19
17
20
- .. important::
21
-
22
- You can only run :dbcommand:`replSetResizeOplog` on
23
- replica set members running with the
24
- :ref:`WiredTiger storage engine <storage-wiredtiger>`.
25
-
26
18
Perform these steps on each :term:`secondary` replica set member
27
19
*first*. Once you have changed the oplog size for all secondary
28
20
members, perform these steps on the :term:`primary`.
@@ -76,3 +68,48 @@ member to 16 gigabytes, or 16000 megabytes.
76
68
.. [#oplog]
77
69
78
70
.. include:: /includes/fact-oplog-size.rst
71
+
72
+ .. compact-oplog-rs:
73
+
74
+ D. (Optional) Compact ``oplog.rs`` to reclaim disk space
75
+ --------------------------------------------------------
76
+
77
+ Reducing the size of the oplog does *not* automatically reclaim
78
+ the disk space allocated to the original oplog size. You must run
79
+ :dbcommand:`compact` against the ``oplog.rs`` collection in the
80
+ ``local`` database to reclaim disk space. There are no benefits to
81
+ running ``compact`` on the ``oplog.rs`` collection after increasing the
82
+ oplog size.
83
+
84
+ .. important::
85
+
86
+ The replica set member cannot replicate oplog entries while the
87
+ ``compact`` operation is ongoing. While ``compact`` runs, the
88
+ member may fall so far behind the primary that it cannot resume
89
+ replication. The likelihood of a member becoming "stale" during
90
+ the ``compact`` procedure increases with cluster write throughput,
91
+ and may be further exacerbated by the reduced oplog size.
92
+
93
+ Consider scheduling a maintenance window during which writes are
94
+ throttled or stopped to mitigate the risk of the member becoming
95
+ "stale" and requiring a :ref:`full resync <resync-replica-member>`.
96
+
97
+ Do **not** run ``compact`` against the primary replica set member.
98
+ Connect a :binary:`mongo <bin.mongo>` shell to the primary and run
99
+ :method:`rs.stepDown()`. If successful, the primary steps down and
100
+ closes all open connections. Reconnect the :binary:`mongo <bin.mongo>`
101
+ shell to the member and run the ``compact`` command on the member.
102
+
103
+ The following operation runs the ``compact`` command against the
104
+ ``oplog.rs`` collection:
105
+
106
+ .. code-block:: javascript
107
+
108
+ use local
109
+ db.runCommand({ "compact" : "oplog.rs" } )
110
+
111
+ For clusters enforcing :ref:`authentication <authentication>`,
112
+ authenticate as a user with the :authaction:`compact` privilege
113
+ action on the ``local`` database and the ``oplog.rs`` collection.
114
+ For complete documentation on :dbcommand:`compact` authentication
115
+ requirements, see :ref:`compact-authentication`.
0 commit comments