You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/core/replication-internals.rst
+7-9Lines changed: 7 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -27,18 +27,20 @@ will reflect writes within one second of the primary. However, various
27
27
exceptional situations may cause secondaries lag behind further. See
28
28
:term:`replication lag` for details.
29
29
30
-
All nodes send heartbeats to all other nodes, and will import
31
-
operations into its oplog from the node with the lowest "ping" time.
30
+
All nodes send heartbeats to all other nodes, and can import
31
+
operations to into its oplog from any other node in the
32
+
cluster.
32
33
33
-
TODO: the lowest "ping" time thing is very specific to 2.0, it wasn't true in 1.8 and probably will be different again in 2.2. Not sure if you care or not.
34
+
.. In 2.0, replicas would import entries from the member lowest
35
+
.. "ping," This wasn't true in 1.8 and will likely change in 2.2.
34
36
35
37
.. _replica-set-implementation:
36
38
37
39
Implementation
38
40
--------------
39
41
40
42
MongoDB uses :term:`single master replication` to ensure that the
41
-
database remains consistent. However, clients possible to modify the
43
+
database remains consistent. However, clients may modify the
42
44
:ref:`read preferences <replica-set-read-preference>` on a
43
45
per-connection basis in order to distribute read operations to the
44
46
secondary members of a replica set. Read-heavy deployments may achieve
@@ -50,8 +52,6 @@ section for more about ":ref:`read preference
50
52
<replica-set-read-preference>`" and ":ref:`write concern
51
53
<replica-set-write-concern>`."
52
54
53
-
TODO: "However, clients possible..."
54
-
55
55
.. note::
56
56
57
57
Use :func:`db.getReplicationInfo()` from a secondary node
@@ -115,12 +115,10 @@ member should become primary.
115
115
Elections are the process that the members of a replica set use to
116
116
select the primary node in a cluster. Elections follow two events:
117
117
primary node that "steps down" or a :term:`secondary` member that
118
-
looses contact with a :term:`primary` node. All members have one vote
118
+
loses contact with a :term:`primary` node. All members have one vote
119
119
in an election, and every :program:`mongod` can veto an election. A
120
120
single member's veto will invalidate the election.
121
121
122
-
TODO: sp: looses
123
-
124
122
An existing primary will step down in response to the
125
123
:dbcommand:`replSetStepDown` command, or if it sees that one of
126
124
the current secondaries is eligible for election *and* has a higher
Copy file name to clipboardExpand all lines: source/core/replication.rst
+18-39Lines changed: 18 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,7 @@ the secondary nodes replicate from the primary asynchronously.
16
16
Database replication with MongoDB, as with other systems, adds redundancy, helps to
17
17
ensure high availability, simplifies certain administrative tasks
18
18
such as backups, and may increase read capacity. Most production
19
-
deployments are or should use replication.
20
-
21
-
TODO: "are or should use replication." are use replication?
19
+
deployments are using or should use replication.
22
20
23
21
If you're familiar with other database systems, you may think about
24
22
replica sets as a more sophisticated form of traditional master-slave replication. [#master-slave]_
@@ -194,11 +192,11 @@ remain a secondary.
194
192
195
193
.. note::
196
194
197
-
When an election occurs, the :program:`mongod` instances will close
198
-
all client connections. This ensures that the clients maintain an accurate
199
-
view of the :term:`replica set` and helps prevent :term:`rollbacks <rollback>`.
200
-
201
-
TODO: it's actually just when a primary steps down that connections are closed.
195
+
When the current :term:`primary` steps down and triggers an
196
+
election, the :program:`mongod` instances will close all client
197
+
connections. This ensures that the clients maintain an accurate
198
+
view of the :term:`replica set` and helps prevent :term:`rollbacks
199
+
<rollback>`.
202
200
203
201
.. seealso:: ":ref:`Replica Set Election Internals <replica-set-election-internals>`"
204
202
@@ -256,35 +254,24 @@ Rollbacks
256
254
~~~~~~~~~
257
255
258
256
In some :term:`failover` situations :term:`primary` nodes will have
259
-
accepted write operations that have replicated to the
257
+
accepted write operations that have *not* replicated to the
260
258
:term:`secondaries <secondary>` after a failover occurs. This case is
261
259
rare and typically occurs as a result of a network partition with
262
260
replication lag. When this node (the former primary) rejoins the
263
261
:term:`replica set` and attempts to continue replication as a
264
-
secondary those operations the former primary must revert these
265
-
operations or "rolled back" these operations to maintain database
262
+
secondary the former primary must revert these
263
+
operations or "roll back" these operations to maintain database
266
264
consistency across the replica set.
267
265
268
-
TODO: ":term:`primary` nodes will have
269
-
accepted write operations that have replicated to the
270
-
:term:`secondaries <secondary>`" -> have not replicated to the secondary
271
-
272
-
TODO: "as a
273
-
secondary those operations the former primary must revert these
274
-
operations or" those operations...these operations
275
-
276
266
MongoDB writes the rollback data to a :term:`BSON` file in the
277
267
database's :setting:`dbpath` directory. Use :doc:`bsondump
278
268
</reference/bsondump>` to read the contents of these rollback files
279
269
and then manually apply the changes to the new primary. There is no
280
270
way for MongoDB to appropriately and fairly handle rollback situations
281
-
without manual intervention. Since rollback situations require an
282
-
administrator's direct intervention, users should strive to avoid
283
-
rollbacks as much as possible. Until an administrator applies this
284
-
rollback data, the former primary remains in a "rollback" status.
285
-
286
-
TODO: "Until an administrator applies this
287
-
rollback data, the former primary remains in a "rollback" status." Untrue! ROLLBACK state should automatically correct itself and the server will end up in SECONDARY state.
271
+
without manual intervention. Even after the node completes the
272
+
rollback and returns to secondary status, administrators will need to
273
+
apply or decide to ignore the rollback data. MongoDB users should strive to avoid
274
+
rollbacks as much as possible.
288
275
289
276
The best strategy for avoiding all rollbacks is to ensure :ref:`write
290
277
propagation <replica-set-write-concern>` to all or some of the
@@ -297,15 +284,6 @@ that might create rollbacks.
297
284
megabytes of data. If your system needs to rollback more than 300
298
285
MB, you will need to manually intervene to recover this data.
299
286
300
-
.. note::
301
-
302
-
After a rollback occurs, the former primary will remain in a
303
-
"rollback" mode until the administrator deals with the rolled back
304
-
data and restarts the :program:`mongod` instance. Only then can the
write durability. The journaling greatly improves the reliability
457
435
and durability of a database. Unless MongoDB runs with journaling, when a
458
-
MongoDB instance terminates ungracefully, the database can loose up to 60 seconds of data,
459
-
and the database may remain in an inconsistent state and
460
-
unrecoverable state.
436
+
MongoDB instance terminates ungracefully, the database can end in a
437
+
corrupt and unrecoverable state.
461
438
462
-
TODO: this isn't true. If you are running w/out journaling and mongod terminates "ungracefully" you can lose _all_ data. Also, you should assume, after a crash w/out journaling, that the db is in an inconsistent (i.e., corrupt) state.
439
+
You should assume that a database, running without journaling, that
440
+
suffers a crash or unclean shutdown is in corrupt or inconsistent
441
+
state.
463
442
464
443
**Use journaling**, however, do not forego proper replication
0 commit comments