@@ -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,57 @@ 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
+ }
272
+ },
273
+ ...
274
+ "foo" : {
275
+ "collections" : 1,
276
+ "clonedCollections" : 0,
277
+ "start" : ISODate("2018-12-04T18:56:36.054Z"),
278
+ "foo.hugeindex" : {
279
+ "documentsToCopy" : 25000,
280
+ "documentsCopied" : 25000,
281
+ "indexes" : 2,
282
+ "fetchedBatches" : 21,
283
+ "start" : ISODate("2018-12-04T18:56:36.056Z")
284
+ }
285
+ },
286
+
287
+ }
288
+ },
223
289
"members" : [
224
290
{
225
291
"_id" : 0,
@@ -439,6 +505,208 @@ following fields:
439
505
440
506
A ``null`` value indicates that no stable checkpoint exists.
441
507
508
+ .. data:: replSetGetStatus.initialSyncStatus
509
+
510
+ .. versionadded:: 3.4
511
+
512
+ *Available only if the command is run with the initialSync: 1
513
+ option on a secondary*
514
+
515
+ A document provides information on the progress and status of
516
+ :ref:`initial sync <replica-set-initial-sync>` on this secondary.
517
+
518
+ .. note::
519
+
520
+ Some fields that relate to the progress of an on-going initial
521
+ sync only appear while the initial sync is in progress and do not
522
+ appear once the initial sync completes.
523
+
524
+ .. data:: replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts
525
+
526
+ .. versionadded:: 3.4
527
+
528
+ *Available only if the command is run with the initialSync: 1
529
+ option on a secondary*
530
+
531
+ The number of times the :ref:`initial sync
532
+ <replica-set-initial-sync>` failed and had to restart on this
533
+ secondary.
534
+
535
+ .. data:: replSetGetStatus.initialSyncStatus.maxFailedInitialSyncAttempts
536
+
537
+ .. versionadded:: 3.4
538
+
539
+ *Available only if the command is run with the initialSync: 1
540
+ option on a secondary*
541
+
542
+ The maximum number of times the :ref:`initial sync
543
+ <replica-set-initial-sync>` can restart on this secondary
544
+ before the member shuts down.
545
+
546
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncStart
547
+
548
+ .. versionadded:: 3.4
549
+
550
+ *Available only if the command is run with the initialSync: 1
551
+ option on a secondary*
552
+
553
+ The start timestamp of the :ref:`initial sync
554
+ <replica-set-initial-sync>` for this secondary.
555
+
556
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncEnd
557
+
558
+ .. versionadded:: 3.4
559
+
560
+ *Available only if the command is run with the initialSync: 1
561
+ option on a secondary*
562
+
563
+ The end timestamp of the :ref:`initial sync
564
+ <replica-set-initial-sync>` for this secondary.
565
+
566
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncElapsedMillis
567
+
568
+ .. versionadded:: 3.4
569
+
570
+ *Available only if the command is run with the initialSync: 1
571
+ option on a secondary*
572
+
573
+ The number of milliseconds between
574
+ :data:`~replSetGetStatus.initialSyncStatus.initialSyncStart`
575
+ and :data:`~replSetGetStatus.initialSyncStatus.initialSyncEnd`.
576
+
577
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncAttempts
578
+
579
+ .. versionadded:: 3.4
580
+
581
+ *Available only if the command is run with the initialSync: 1
582
+ option on a secondary*
583
+
584
+ Array of documents where each document corresponds to a single
585
+ :ref:`initial sync <replica-set-initial-sync>` attempt. See also
586
+ :data:`~replSetGetStatus.initialSyncStatus.failedInitialSyncAttempts`.
587
+
588
+ Each document contains the following information for the initial sync attempt:
589
+
590
+ .. code-block:: javascript
591
+
592
+ {
593
+ "durationMillis" : <duration in milliseconds>,
594
+ "status" : <exit status>,
595
+ "syncSource" : <source node from which this secondary performs initial sync>
596
+ }
597
+
598
+ .. data:: replSetGetStatus.initialSyncStatus.fetchedMissingDocs
599
+
600
+ .. versionadded:: 3.4
601
+
602
+ *Available only if the command is run with the initialSync: 1
603
+ option on a secondary*
604
+
605
+ The number of missing (i.e. uncloned) documents that were fetched
606
+ from the sync source in order to apply to those documents the
607
+ updates that occurred after the :ref:`initial sync
608
+ <replica-set-initial-sync>` started.
609
+
610
+ As part of the initial sync process, the secondary uses the oplog
611
+ to update its data set to reflect the current state of the
612
+ replica set.
613
+
614
+ .. data:: replSetGetStatus.initialSyncStatus.appliedOps
615
+
616
+ .. versionadded:: 3.4
617
+
618
+ *Available only if the command is run with the initialSync: 1
619
+ option on a secondary*
620
+
621
+ The number of ops that occurred after the :ref:`initial sync
622
+ <replica-set-initial-sync>` started and were applied after cloning
623
+ the databases.
624
+
625
+ As part of the initial sync process, the secondary uses the oplog
626
+ to update its data set to reflect the current state of the
627
+ replica set.
628
+
629
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogStart
630
+
631
+ .. versionadded:: 3.4
632
+
633
+ *Available only if the command is run with the initialSync: 1
634
+ option on a secondary*
635
+
636
+ The start timestamp of the oplog application stage of the
637
+ :ref:`initial sync <replica-set-initial-sync>` where the
638
+ secondary applies changes that occurred after the initial sync
639
+ start.
640
+
641
+ As part of the initial sync process, the secondary uses the oplog
642
+ to update its data set to reflect the current state of the
643
+ replica set.
644
+
645
+ .. data:: replSetGetStatus.initialSyncStatus.initialSyncOplogEnd
646
+
647
+ .. versionadded:: 3.4
648
+
649
+ *Available only if the command is run with the initialSync: 1
650
+ option on a secondary*
651
+
652
+ The end timestamp of the oplog application stage of the
653
+ :ref:`initial sync <replica-set-initial-sync>` where the
654
+ secondary applies changes that occurred after the initial sync
655
+ start.
656
+
657
+ As part of the initial sync process, the secondary uses the oplog
658
+ to update its data set to reflect the current state of the
659
+ replica set.
660
+
661
+ .. data:: replSetGetStatus.initialSyncStatus.databases
662
+
663
+ .. versionadded:: 3.4
664
+
665
+ *Available only if the command is run with the initialSync: 1
666
+ option on a secondary*
667
+
668
+ Detail on the databases cloned during :ref:`initial sync
669
+ <replica-set-initial-sync>`.
670
+
671
+ .. data:: replSetGetStatus.initialSyncStatus.databases.databasesCloned
672
+
673
+ .. versionadded:: 3.4
674
+
675
+ *Available only if the command is run with the initialSync: 1
676
+ option on a secondary*
677
+
678
+ Number of databases cloned during :ref:`initial sync
679
+ <replica-set-initial-sync>`.
680
+
681
+ .. data:: replSetGetStatus.initialSyncStatus.databases.<dbname>
682
+
683
+ .. versionadded:: 3.4
684
+
685
+ *Available only if the command is run with the initialSync: 1
686
+ option on a secondary*
687
+
688
+ For each database, a document that returns information regarding
689
+ the progress of the cloning of that database.
690
+
691
+ .. code-block:: javascript
692
+
693
+ {
694
+ "collections" : <number of collections to clone in the database>,
695
+ "clonedCollections" : <number of collections cloned to date>,
696
+ "start" : <start date and time for the database clone>,
697
+ "end" : <end date and time for the database clone>,
698
+ "elapsedMillis" : <duration of the database clone>,
699
+ "<db>.<collection>" : {
700
+ "documentsToCopy" : <number of documents to copy>,
701
+ "documentsCopied" : <number of documents copied to date>,
702
+ "indexes" : <number of indexes>,
703
+ "fetchedBatches" : <number of batches of documents fetched to date>,
704
+ "start" : <start date and time for the collection clone>,
705
+ "end" : <end date and time for the collection clone>,
706
+ "elapsedMillis" : <duration of the collection clone>,
707
+ }
708
+ }
709
+
442
710
.. data:: replSetGetStatus.members
443
711
444
712
The ``members`` field holds an array that contains a document for
0 commit comments