@@ -24,12 +24,24 @@ Definition
24
24
25
25
db.adminCommand( { replSetGetStatus: 1 } )
26
26
27
- The value specified does not affect the output of the command. Data
28
- provided by this command derives from data included in heartbeats
29
- sent to the server by other members of the replica set.
27
+ Starting in MongoDB 3.4, when running on a :doc:`secondary
28
+ </core/replica-set-secondary>` member, you can optionally include
29
+ ``initialSync: 1`` to return :ref:`initial sync
30
+ <replica-set-initial-sync>` status information:
31
+
32
+ .. code-block:: javascript
33
+
34
+ db.adminCommand( { replSetGetStatus: 1, initialSync: 1 } )
35
+
36
+ Data provided by this command derives from data included in
37
+ heartbeats sent to the server by other members of the replica set.
30
38
Because of the frequency of heartbeats, these data can be several
31
39
seconds out of date.
32
40
41
+ The :binary:`~bin.mongo` shell provides the :method:`rs.status()`
42
+ helper; however, you cannot specify the ``initialSync: 1`` option
43
+ using the helper.
44
+
33
45
The :binary:`~bin.mongod` instance must have replication enabled and be a
34
46
member of a replica set for :dbcommand:`replSetGetStatus` to return
35
47
successfully.
@@ -182,10 +194,13 @@ Example
182
194
183
195
The following example runs the :dbcommand:`replSetGetStatus`
184
196
command on the :term:`admin database` of the replica set
185
- primary.
197
+ primary. In this example, the optional ``initialSync: 1`` is
198
+ included in the command (you can omit if you do not want to
199
+ return the initial sync status):
200
+
186
201
.. code-block:: javascript
187
202
188
- db.adminCommand( { replSetGetStatus : 1 } )
203
+ db.adminCommand( { replSetGetStatus : 1, initialSync: 1 } )
189
204
190
205
The command returns the following output for an example replica set secondary:
191
206
@@ -220,6 +235,59 @@ Example
220
235
},
221
236
"lastStableRecoveryTimestamp" : Timestamp(1543869214, 1),
222
237
"lastStableCheckpointTimestamp" : Timestamp(1543869214, 1),
238
+ "initialSyncStatus" : {
239
+ "failedInitialSyncAttempts" : 0,
240
+ "maxFailedInitialSyncAttempts" : 10,
241
+ "initialSyncStart" : ISODate("2018-12-03T20:29:22.929Z"),
242
+ "initialSyncEnd" : ISODate("2018-12-03T20:29:23.546Z"),
243
+ "initialSyncElapsedMillis" : 617,
244
+ "initialSyncAttempts" : [
245
+ {
246
+ "durationMillis" : 204,
247
+ "status" : "OK",
248
+ "syncSource" : "m1.example.net:27017"
249
+ }
250
+ ],
251
+ "fetchedMissingDocs" : 0,
252
+ "appliedOps" : 0,
253
+ "initialSyncOplogStart" : Timestamp(1543868962, 1),
254
+ "initialSyncOplogEnd" : Timestamp(1543868962, 1),
255
+ "databases" : {
256
+ "databasesCloned" : 1,
257
+ "admin" : {
258
+ "collections" : 1,
259
+ "clonedCollections" : 1,
260
+ "start" : ISODate("2018-12-03T20:29:23.342Z"),
261
+ "end" : ISODate("2018-12-03T20:29:23.528Z"),
262
+ "elapsedMillis" : 186,
263
+ "admin.system.version" : {
264
+ "documentsToCopy" : 1,
265
+ "documentsCopied" : 1,
266
+ "indexes" : 1,
267
+ "fetchedBatches" : 1,
268
+ "start" : ISODate("2018-12-03T20:29:23.344Z"),
269
+ "end" : ISODate("2018-12-03T20:29:23.528Z"),
270
+ "elapsedMillis" : 184,
271
+ "receivedBatches" : 1 // Added in 4.2
272
+ }
273
+ },
274
+ ...
275
+ "foo" : {
276
+ "collections" : 1,
277
+ "clonedCollections" : 0,
278
+ "start" : ISODate("2018-12-04T18:56:36.054Z"),
279
+ "foo.hugeindex" : {
280
+ "documentsToCopy" : 25000,
281
+ "documentsCopied" : 25000,
282
+ "indexes" : 2,
283
+ "fetchedBatches" : 21,
284
+ "start" : ISODate("2018-12-04T18:56:36.056Z"),
285
+ "receivedBatches" : 21 // Added in 4.2
286
+ }
287
+ },
288
+
289
+ }
290
+ },
223
291
"members" : [
224
292
{
225
293
"_id" : 0,
@@ -439,6 +507,209 @@ following fields:
439
507
440
508
A ``null`` value indicates that no stable checkpoint exists.
441
509
510
+ .. data:: replSetGetStatus.initialSyncStatus
511
+
512
+ .. versionadded:: 3.4
513
+
514
+ *Available only if the command is run with the initialSync: 1
515
+ option on a secondary*
516
+
517
+ A document provides information on the progress and status of
518
+ :ref:`initial sync <replica-set-initial-sync>` on this secondary.
519
+
520
+ .. note::
521
+
522
+ Some fields that relate to the progress of an on-going initial
523
+ sync only appear while the initial sync is in progress and do not
524
+ appear once the initial sync completes.
525
+
526
+ .. data:: replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts
527
+
528
+ .. versionadded:: 3.4
529
+
530
+ *Available only if the command is run with the initialSync: 1
531
+ option on a secondary*
532
+
533
+ The number of times the :ref:`initial sync
534
+ <replica-set-initial-sync>` failed and had to restart on this
535
+ secondary.
536
+
537
+ .. data:: replSetGetStatus.initialSyncStatus.maxFailedInitialSyncAttempts
538
+
539
+ .. versionadded:: 3.4
540
+
541
+ *Available only if the command is run with the initialSync: 1
542
+ option on a secondary*
543
+
544
+ The maximum number of times the :ref:`initial sync
545
+ <replica-set-initial-sync>` can restart on this secondary
546
+ before the member shuts down.
547
+
548
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncStart
549
+
550
+ .. versionadded:: 3.4
551
+
552
+ *Available only if the command is run with the initialSync: 1
553
+ option on a secondary*
554
+
555
+ The start timestamp of the :ref:`initial sync
556
+ <replica-set-initial-sync>` for this secondary.
557
+
558
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncEnd
559
+
560
+ .. versionadded:: 3.4
561
+
562
+ *Available only if the command is run with the initialSync: 1
563
+ option on a secondary*
564
+
565
+ The end timestamp of the :ref:`initial sync
566
+ <replica-set-initial-sync>` for this secondary.
567
+
568
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncElapsedMillis
569
+
570
+ .. versionadded:: 3.4
571
+
572
+ *Available only if the command is run with the initialSync: 1
573
+ option on a secondary*
574
+
575
+ The number of milliseconds between
576
+ :data:`~replSetGetStatus.initialSyncStatus.initialSyncStart`
577
+ and :data:`~replSetGetStatus.initialSyncStatus.initialSyncEnd`.
578
+
579
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncAttempts
580
+
581
+ .. versionadded:: 3.4
582
+
583
+ *Available only if the command is run with the initialSync: 1
584
+ option on a secondary*
585
+
586
+ Array of documents where each document corresponds to a single
587
+ :ref:`initial sync <replica-set-initial-sync>` attempt. See also
588
+ :data:`~replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts`.
589
+
590
+ Each document contains the following information for the initial sync attempt:
591
+
592
+ .. code-block:: javascript
593
+
594
+ {
595
+ "durationMillis" : <duration in milliseconds>,
596
+ "status" : <exit status>,
597
+ "syncSource" : <source node from which this secondary performs initial sync>
598
+ }
599
+
600
+ .. data:: replSetGetStatus.initialSyncStatus.fetchedMissingDocs
601
+
602
+ .. versionadded:: 3.4
603
+
604
+ *Available only if the command is run with the initialSync: 1
605
+ option on a secondary*
606
+
607
+ The number of missing (i.e. uncloned) documents that were fetched
608
+ from the sync source in order to apply to those documents the
609
+ updates that occurred after the :ref:`initial sync
610
+ <replica-set-initial-sync>` started.
611
+
612
+ As part of the initial sync process, the secondary uses the oplog
613
+ to update its data set to reflect the current state of the
614
+ replica set.
615
+
616
+ .. data:: replSetGetStatus.initialSyncStatus.appliedOps
617
+
618
+ .. versionadded:: 3.4
619
+
620
+ *Available only if the command is run with the initialSync: 1
621
+ option on a secondary*
622
+
623
+ The number of ops that occurred after the :ref:`initial sync
624
+ <replica-set-initial-sync>` started and were applied after cloning
625
+ the databases.
626
+
627
+ As part of the initial sync process, the secondary uses the oplog
628
+ to update its data set to reflect the current state of the
629
+ replica set.
630
+
631
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogStart
632
+
633
+ .. versionadded:: 3.4
634
+
635
+ *Available only if the command is run with the initialSync: 1
636
+ option on a secondary*
637
+
638
+ The start timestamp of the oplog application stage of the
639
+ :ref:`initial sync <replica-set-initial-sync>` where the
640
+ secondary applies changes that occurred after the initial sync
641
+ start.
642
+
643
+ As part of the initial sync process, the secondary uses the oplog
644
+ to update its data set to reflect the current state of the
645
+ replica set.
646
+
647
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogEnd
648
+
649
+ .. versionadded:: 3.4
650
+
651
+ *Available only if the command is run with the initialSync: 1
652
+ option on a secondary*
653
+
654
+ The end timestamp of the oplog application stage of the
655
+ :ref:`initial sync <replica-set-initial-sync>` where the
656
+ secondary applies changes that occurred after the initial sync
657
+ start.
658
+
659
+ As part of the initial sync process, the secondary uses the oplog
660
+ to update its data set to reflect the current state of the
661
+ replica set.
662
+
663
+ .. data:: replSetGetStatus.initialSyncStatus.databases
664
+
665
+ .. versionadded:: 3.4
666
+
667
+ *Available only if the command is run with the initialSync: 1
668
+ option on a secondary*
669
+
670
+ Detail on the databases cloned during :ref:`initial sync
671
+ <replica-set-initial-sync>`.
672
+
673
+ .. data:: replSetGetStatus.initialSyncStatus.databases.databasesCloned
674
+
675
+ .. versionadded:: 3.4
676
+
677
+ *Available only if the command is run with the initialSync: 1
678
+ option on a secondary*
679
+
680
+ Number of databases cloned during :ref:`initial sync
681
+ <replica-set-initial-sync>`.
682
+
683
+ .. data:: replSetGetStatus.initialSyncStatus.databases.<dbname>
684
+
685
+ .. versionadded:: 3.4
686
+
687
+ *Available only if the command is run with the initialSync: 1
688
+ option on a secondary*
689
+
690
+ For each database, a document that returns information regarding
691
+ the progress of the cloning of that database.
692
+
693
+ .. code-block:: javascript
694
+
695
+ {
696
+ "collections" : <number of collections to clone in the database>,
697
+ "clonedCollections" : <number of collections cloned to date>,
698
+ "start" : <start date and time for the database clone>,
699
+ "end" : <end date and time for the database clone>,
700
+ "elapsedMillis" : <duration of the database clone>,
701
+ "<db>.<collection>" : {
702
+ "documentsToCopy" : <number of documents to copy>,
703
+ "documentsCopied" : <number of documents copied to date>,
704
+ "indexes" : <number of indexes>,
705
+ "fetchedBatches" : <number of batches of documents fetched to date>,
706
+ "start" : <start date and time for the collection clone>,
707
+ "end" : <end date and time for the collection clone>,
708
+ "elapsedMillis" : <duration of the collection clone>,
709
+ "receivedBatches" : <number of batches of documents received to date> // Added in 4.2
710
+ }
711
+ }
712
+
442
713
.. data:: replSetGetStatus.members
443
714
444
715
The ``members`` field holds an array that contains a document for
0 commit comments