-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
configuration-options.txt
983 lines (649 loc) · 30.8 KB
/
configuration-options.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
==========================
Configuration File Options
==========================
.. default-domain:: mongodb
.. When editing this file make sure that the man pages for the
binaries reflect all changes that you've made.
That is:
- /reference/mongod.txt
- /reference/mongos.txt
Synopsis
--------
Administrators and users can control :program:`mongod` or
:program:`mongos` instances at runtime either directly from
:doc:`mongod's command line arguments </reference/program/mongod>` or using a
configuration file.
While both methods are functionally equivalent and all settings are
similar, the configuration file method is preferable. If you
installed from a package and have started MongoDB using your system's
:term:`control script`, you're already using a configuration file.
To start :program:`mongod` or :program:`mongos` using a config file,
use one of the following forms:
.. code-block:: sh
mongod --config /etc/mongodb.conf
mongod -f /etc/mongodb.conf
mongos --config /srv/mongodb/mongos.conf
mongos -f /srv/mongodb/mongos.conf
Declare all settings in this file using the following form:
.. code-block:: sh
<setting> = <value>
.. versionadded:: 2.0
*Before* version 2.0, Boolean (i.e. ``true|false``) or "flag"
parameters, register as true, if they appear in the configuration
file, regardless of their value.
.. include:: /includes/note-configuration-file-must-be-ascii.rst
Settings
--------
.. setting:: verbose
*Default:* false
Increases the amount of internal reporting returned on standard
output or in the log file generated by :setting:`logpath`. To
enable :setting:`verbose` or to enable increased verbosity with
:setting:`vvvv`, set these options as in the following example:
.. code-block:: sh
verbose = true
vvvv = true
MongoDB has the following levels of verbosity:
.. setting:: v
*Default:* false
Alternate form of :setting:`verbose`.
.. setting:: vv
*Default:* false
Additional increase in verbosity of output and logging.
.. setting:: vvv
*Default:* false
Additional increase in verbosity of output and logging.
.. setting:: vvvv
*Default:* false
Additional increase in verbosity of output and logging.
.. setting:: vvvvv
*Default:* false
Additional increase in verbosity of output and logging.
.. setting:: port
*Default:* 27017
Specifies a TCP port for the :program:`mongod` or :program:`mongos`
instance to listen for client connections. UNIX-like systems
require root access for ports with numbers lower than 1024.
.. setting:: bind_ip
*Default:* All interfaces.
Set this option to configure the :program:`mongod` or
:program:`mongos` process to bind to and listen for connections
from applications on this address. You may attach :program:`mongod`
or :program:`mongos` instances to any interface; however, if you
attach the process to a publicly accessible interface, implement
proper authentication or firewall restrictions to protect the
integrity of your database.
You may concatenate a list of comma separated values to bind
:program:`mongod` to multiple IP addresses.
.. setting:: maxConns
*Default:* depends on system (i.e. ulimit and file descriptor)
limits. Unless set, MongoDB will not limit its own connections.
Specifies a value to set the maximum number of simultaneous
connections that :program:`mongod` or :program:`mongos` will
accept. This setting has no effect if it is higher than your
operating system's configured maximum connection tracking
threshold.
This is particularly useful for :program:`mongos` if you have a
client that creates a number of connections but allows them to
timeout rather than close the connections. When you set
:setting:`maxConns`, ensure the value is slightly higher than the
size of the connection pool or the total number of connections to
prevent erroneous connection spikes from propagating to the members
of a :term:`shard` cluster.
.. include:: /includes/note-max-conns-max.rst
.. setting:: objcheck
*Default:* true
.. versionchanged:: 2.4
The default setting for :setting:`objcheck` became ``true`` in
2.4. In earlier versions :setting:`objcheck` was ``false`` by
default.
Forces the :program:`mongod` to validate all requests from clients
upon receipt to ensure that clients never insert invalid documents
into the database. For objects with a high degree of sub-document
nesting, :setting:`objcheck` can have a small impact on
performance. You can set :setting:`noobjcheck` to disable object
checking at run-time.
.. setting:: noobjcheck
.. versionadded:: 2.4
*Default:* false
Disables the default object validation that MongoDB performs on all
incoming BSON documents.
.. setting:: logpath
*Default:* None. (i.e. ``/dev/stdout``)
Specify the path to a file name for the log file that will hold all
diagnostic logging information.
Unless specified, :program:`mongod` will output all log information
to the standard output. Unless :setting:`logappend` is ``true``,
the logfile will be overwritten when the process restarts.
.. note::
Currently, MongoDB will overwrite the contents of the log file
if the :setting:`logappend` is not used. This behavior may
change in the future depending on the outcome of
:issue:`SERVER-4499`.
.. setting:: logappend
*Default:* false
Set to ``true`` to add new entries to the end of the logfile rather
than overwriting the content of the log when the process restarts.
If this setting is not specified, then MongoDB will overwrite the
existing logfile upon start up.
.. note::
The behavior of the logging system may change in the near
future in response to the :issue:`SERVER-4499` case.
.. setting:: syslog
.. versionadded:: 2.2
Sends all logging output to the host's :term:`syslog` system rather
than to standard output or a log file as with :setting:`logpath`.
.. important:: You cannot use :setting:`syslog` with :setting:`logpath`.
.. setting:: pidfilepath
*Default:* None.
Specify a file location to hold the :term:`PID` or process ID of the
:program:`mongod` process. Useful for tracking the :program:`mongod` process in
combination with the :setting:`fork` setting.
Without a specified :setting:`pidfilepath`, :program:`mongos`
creates no PID file.
Without this option, :program:`mongod` creates no PID file.
.. setting:: keyFile
*Default:* None.
Specify the path to a key file to store authentication
information. This option is only useful for the connection between
replica set members.
.. seealso:: :ref:`Replica Set Security <replica-set-security>`
.. setting:: nounixsocket
*Default:* false
Set to ``true`` to disable listening on the UNIX
socket.
MongoDB always creates and listens on the UNIX socket, unless
:setting:`nounixsocket` is set, or :setting:`bind_ip` is *not* set,
or :setting:`bind_ip` does *not* specify ``127.0.0.1``.
.. setting:: unixSocketPrefix
*Default:* ``/tmp``
Specifies a path for the UNIX socket. Unless this option has a
value :program:`mongod` creates a socket with ``/tmp`` as a
prefix.
MongoDB will *always* create and listen on a UNIX socket, unless
:setting:`nounixsocket` is set, :setting:`bind_ip` is *not* set.
or :setting:`bind_ip` does *not* specify ``127.0.0.1``.
.. setting:: fork
*Default:* false
Set to ``true`` to enable a :term:`daemon` mode for
:program:`mongod` that runs the process in the background.
.. setting:: auth
*Default:* false
Set to ``true`` to enable database authentication for users
connecting from remote hosts. Configure users via the :doc:`mongo
shell </reference/program/mongo>`. If no users exist, the localhost
interface will continue to have access to the database until you
create the first user.
.. setting:: cpu
*Default:* false
Set to ``true`` to force :program:`mongod` to report every four
seconds CPU utilization and the amount of time that the processor
waits for I/O operations to complete (i.e. I/O wait.) MongoDB writes
this data to standard output, or the logfile if using the
:setting:`logpath` option.
.. setting:: dbpath
*Default:* ``/data/db/``
Set this value to designate a directory for the :program:`mongod`
instance to store its data. Typical locations include:
``/srv/mongodb``, ``/var/lib/mongodb`` or ``/opt/mongodb``
Unless specified, :program:`mongod` will look for data files in the
default ``/data/db`` directory. (Windows systems use the
``\data\db`` directory.) If you installed using a package
management system. Check the ``/etc/mongodb.conf`` file provided by
your packages to see the configuration of the :setting:`dbpath`.
.. setting:: diaglog
*Default:* 0
Creates a very verbose :term:`diagnostic log` for troubleshooting and
recording various errors. MongoDB writes these log files in the
:setting:`dbpath` directory and names them :file:`diaglog.<time in
hex>`, where ``<time-in-hex>`` is the initiation time of logging as a
hexadecimal string.
The value of this setting configures the level of
verbosity. Possible values, and their impact are as follows.
========= ===================================
**Value** **Setting**
--------- -----------------------------------
0 Off. No logging.
1 Log write operations.
2 Log read operations.
3 Log both read and write operations.
7 Log write and some read operations.
========= ===================================
You can use the :program:`mongosniff` tool to replay this output
for investigation. Given a typical diaglog file, located at
``/data/db/diaglog.4f76a58c``, you might use a command in the
following form to read these files:
.. code-block:: sh
mongosniff --source DIAGLOG /data/db/diaglog.4f76a58c
:setting:`diaglog` is for internal use and not intended for most
users.
.. include:: /includes/warning-diaglogging-off.rst
.. setting:: directoryperdb
*Default:* false
Set to ``true`` to modify the storage pattern of the data directory
to store each database's files in a distinct folder. This option
will create directories within the :setting:`dbpath` named for each
database.
Use this option in conjunction with your file system and device
configuration so that MongoDB will store data on a number of
distinct disk devices to increase write throughput or disk
capacity.
.. warning::
.. |directoryperdb-option-name| replace:: :setting:`directoryperdb`
.. include:: /includes/fact-directory-per-db-requires-migration.rst
.. _setting-journal:
.. setting:: journal
*Default:* (on 64-bit systems) true
*Default:* (on 32-bit systems) false
Set to true to enable operation journaling to ensure write
durability and data consistency.
Set to false to prevent the overhead of journaling in situations
where durability is not required. To reduce the impact of the
journaling on disk usage, you can leave :setting:`journal`
enabled, and set :setting:`smallfiles` to true to reduce the size
of the data and journal files.
.. note:: You must use :setting:`nojournal` to disable journaling
on 64-bit systems.
.. setting:: journalCommitInterval
*Default:* 100 or 30
Set this value to specify the maximum amount of time for
:program:`mongod` to allow between journal operations. Lower
values increase the durability of the journal, at the possible
expense of disk performance.
.. include:: /includes/fact-journal-commit-interval-length.rst
This option accepts values between 2 and 300 milliseconds.
.. include:: /includes/fact-journal-commit-interval-with-gle.rst
.. setting:: ipv6
*Default:* false
Set to ``true`` to IPv6 support to allow clients to connect to
:program:`mongod` using IPv6 networks. :program:`mongod` disables
IPv6 support by default in :program:`mongod` and all utilities.
.. setting:: jsonp
*Default:* false
Set to ``true`` to permit :term:`JSONP` access via an HTTP
interface. Consider the security implications of allowing this
activity before setting this option.
.. setting:: noauth
*Default:* true
Disable authentication. Currently the default. Exists for future
compatibility and clarity.
For consistency use the :setting:`auth` option.
.. setting:: nohttpinterface
*Default:* false
Set to ``true`` to disable the HTTP interface. This command will
override the :setting:`rest` and disable the HTTP interface if you
specify both.
.. include:: /includes/note-kerberos-unsupported-in-http-console.rst
.. versionchanged:: 2.1.2
The :setting:`nohttpinterface` option is not available for :program:`mongos` instances before 2.1.2
.. setting:: nojournal
*Default:* (on 64-bit systems) false
*Default:* (on 32-bit systems) true
Set ``nojournal = true`` to disable durability journaling. By
default, :program:`mongod` enables journaling in 64-bit versions
after v2.0.
.. note:: You must use :setting:`journal` to enable journaling
on 32-bit systems.
.. setting:: noprealloc
*Default:* false
Set ``noprealloc = true`` to disable the preallocation of data
files. This will shorten the start up time in some cases, but can
cause significant performance penalties during normal operations.
.. setting:: noscripting
*Default:* false
Set ``noscripting = true`` to disable the scripting engine.
.. setting:: notablescan
*Default:* false
Set ``notablescan = true`` to forbid operations that require a
table scan.
.. setting:: nssize
*Default:* 16
Specify this value in megabytes. The maximum size is 2047 megabytes.
Use this setting to control the default size for all newly created
namespace files (i.e ``.ns``). This option has no impact on the
size of existing namespace files.
See :limit:`Limits on namespaces <Number of Namespaces>`.
.. setting:: profile
*Default:* 0
Modify this value to changes the level of database profiling, which
inserts information about operation performance into output of
:program:`mongod` or the log file if specified by
:setting:`logpath`. The following levels are available:
========= ==================================
**Level** **Setting**
--------- ----------------------------------
0 Off. No profiling.
1 On. Only includes slow operations.
2 On. Includes all operations.
========= ==================================
By default, :program:`mongod` disables profiling. Database profiling
can impact database performance because the profiler must record
and process all database operations. Enable this option only after
careful consideration.
.. setting:: quota
*Default:* false
Set to ``true`` to enable a maximum limit for the number data files
each database can have. The default quota is 8 data files, when
``quota`` is true. Adjust the quota size with the with the
:setting:`quotaFiles` setting.
.. setting:: quotaFiles
*Default:* 8
Modify limit on the number of data files per database. This option
requires the :setting:`quota` setting.
.. setting:: rest
*Default:* false
Set to ``true`` to enable a simple :term:`REST` interface.
.. setting:: repair
*Default:* false
Set to ``true`` to run a repair routine on all databases following
start up. In general you should set this option on the command line
and *not* in the :doc:`configuration file
</administration/configuration>` or in a :term:`control script`.
Use the :option:`mongod --repair` option to access this
functionality.
.. note::
Because :program:`mongod` rewrites all of the database files
during the repair routine, if you do not run :setting:`repair`
under the same user account as :program:`mongod` usually runs,
you will need to run ``chown`` on your database files to correct
the permissions before starting :program:`mongod` again.
.. setting:: repairpath
*Default:* A ``_tmp`` directory in the :setting:`dbpath`.
Specify the path to the directory containing MongoDB data files, to
use in conjunction with the :setting:`repair` setting or
:option:`mongod --repair` operation. Defaults to a ``_tmp``
directory within the :setting:`dbpath`.
.. setting:: slowms
*Default:* 100
Specify values in milliseconds.
Sets the threshold for :program:`mongod` to consider a query "slow"
for the database profiler. The database logs all slow queries to
the log, even when the profiler is not turned on. When the database
profiler is on, :program:`mongod` the profiler writes to the
``system.profile`` collection.
.. seealso:: :setting:`profile`
.. setting:: smallfiles
*Default:* false
Set to ``true`` to modify MongoDB to use a smaller default data
file size. Specifically, :setting:`smallfiles` reduces the initial
size for data files and limits them to 512
megabytes. The :setting:`smallfiles` setting also reduces the size of each
:term:`journal` files from 1 gigabyte to 128 megabytes.
Use the :setting:`smallfiles` setting if you have a large number of databases
that each hold a small quantity of data. The :setting:`smallfiles` setting can
lead :program:`mongod` to create many files,
which may affect performance for larger databases.
.. setting:: syncdelay
*Default:* 60
:program:`mongod` writes data very quickly to the journal, and
lazily to the data files. :setting:`syncdelay` controls how much
time can pass before MongoDB flushes data to the *database files* via an
:term:`fsync` operation. The default setting is 60 seconds. In
almost every situation you should not set this value and use the
default setting.
The :dbcommand:`serverStatus` command reports the background flush
thread's status via the :data:`~serverStatus.backgroundFlushing` field.
:setting:`syncdelay` has no effect on the :setting:`journal`
files or :doc:`journaling </core/journaling>`.
.. warning::
If you set :setting:`syncdelay` to ``0``, MongoDB will not sync
the memory mapped files to disk. Do not set this value on
production systems.
.. setting:: sysinfo
*Default:* false
When set to ``true``, :program:`mongod` returns diagnostic system
information regarding the page size, the number of physical pages,
and the number of available physical pages to standard output.
More typically, run this operation by way of the :option:`mongod --sysinfo`
command. When running with the :setting:`sysinfo`, only
:program:`mongod` only outputs the page information and no database
process will start.
.. setting:: upgrade
*Default:* false
When set to ``true`` this option upgrades the on-disk data format
of the files specified by the :setting:`dbpath` to the latest
version, if needed.
This option only affects the operation of :program:`mongod` if the
data files are in an old format.
When specified for a :program:`mongos` instance, this option updates
the meta data format used by the :term:`config database`.
.. note::
In most cases you should **not** set this value, so you can
exercise the most control over your upgrade process. See the MongoDB
`release notes <http://www.mongodb.org/downloads>`_ (on the
download page) for more information about the upgrade process.
.. setting:: traceExceptions
*Default:* false
For internal diagnostic use only.
.. setting:: quiet
*Default:* false
Runs the :program:`mongod` or :program:`mongos` instance in a quiet
mode that attempts to limit the amount of output. This option suppresses:
- output from :term:`database commands <database command>`,
including :dbcommand:`drop`, :dbcommand:`dropIndexes`,
:dbcommand:`diagLogging`, :dbcommand:`validate`, and
:dbcommand:`clean`.
- replication activity.
- connection accepted events.
- connection closed events.
.. note::
For production systems this option is **not** recommended as it may make
tracking problems during particular connections much more difficult.
.. setting:: setParameter
.. versionadded:: 2.4
Specifies an option to configure on startup. Specify multiple
options with multiple :setting:`setParameter` options. See
:doc:`/reference/parameters` for full documentation of these
parameters. The :dbcommand:`setParameter` database command provides
access to many of these parameters.
Declare all :dbcommand:`setParameter` settings in this file using the following form:
.. code-block:: sh
setParameter = <parameter>=<value>
For :program:`mongod` the following options are available using
:setting:`setParameter`:
.. include:: /includes/list-set-parameters-mongod.rst
For :program:`mongos` the following options are available using
:setting:`setParameter`:
.. include:: /includes/list-set-parameters-mongos.rst
.. setting:: noIndexBuildRetry
By default, :program:`mongod` will attempt to rebuild indexes upon
start-up *if* :program:`mongod` shuts down or stops in the middle
of an index build. When you specify :option:`--noIndexBuildRetry`,
:program:`mongod` will not attempt to rebuild the index.
Replication Options
~~~~~~~~~~~~~~~~~~~
.. setting:: replSet
*Default:* <none>
*Form:* <setname>
Use this setting to configure replication with replica
sets. Specify a replica set name as an argument to this set. All
hosts must have the same set name.
.. seealso:: :doc:`/replication`,
:doc:`/administration/replica-set-deployment`, and
:doc:`/reference/replica-configuration`
.. setting:: oplogSize
Specifies a maximum size in megabytes for the replication operation
log (e.g. :term:`oplog`.) :program:`mongod` creates an oplog
based on the maximum amount of space available. For 64-bit systems,
the oplog is typically 5% of available disk space.
Once the :program:`mongod` has created the oplog for the first
time, changing :setting:`oplogSize` will not affect the size of the
oplog.
.. setting:: fastsync
*Default:* false
In the context of :term:`replica set` replication, set this option
to ``true`` if you have seeded this member with a snapshot of the
:term:`dbpath` of another member of the set. Otherwise the
:program:`mongod` will attempt to perform an initial sync, as though the member were a new member.
.. warning::
If the data is not perfectly synchronized *and*
:program:`mongod` starts with :setting:`fastsync`, then the
secondary or slave will be permanently out of sync with the
primary, which may cause significant consistency problems.
.. setting:: replIndexPrefetch
.. versionadded:: 2.2
*Default:* ``all``
*Values:* ``all``, ``none``, and ``_id_only``
You can only use :setting:`replIndexPrefetch` in conjunction with
:setting:`replSet`.
By default :term:`secondary` members of a :term:`replica set` will
load all indexes related to an operation into memory before
applying operations from the oplog. You can modify this behavior so
that the secondaries will only load the ``_id`` index. Specify
``_id_only`` or ``none`` to prevent the :program:`mongod` from
loading *any* index into memory.
Master/Slave Replication
~~~~~~~~~~~~~~~~~~~~~~~~
.. setting:: master
*Default:* false
Set to ``true`` to configure the current instance to act as
:term:`master` instance in a replication configuration.
.. setting:: slave
*Default:* false
Set to ``true`` to configure the current instance to act as
:term:`slave` instance in a replication configuration.
.. setting:: source
*Default:* <>
*Form:* <host><:port>
Used with the :setting:`slave` setting to specify the
:term:`master` instance from which this :term:`slave` instance will
replicate
.. setting:: only
*Default:* <>
Used with the :setting:`slave` option, :setting:`only`
specifies only a single :term:`database` to replicate.
.. setting:: slaveDelay
*Default:* 0
Used with the :setting:`slave` setting, :setting:`slaveDelay`
configures a "delay" in seconds, for this slave to wait to apply
operations from the :term:`master` instance.
.. setting:: autoresync
*Default:* false
Used with the :setting:`slave` setting, set :setting:`autoresync` to
``true`` to force the :term:`slave` to automatically resync if it
is more than 10 seconds behind the master. This setting may be
problematic if the :setting:`oplogSize` of the
:term:`oplog` is too small.
If the :term:`oplog` is not large
enough to store the difference in changes between the master's
current state and the state of the slave, this instance will forcibly
resync itself unnecessarily. When you set the :setting:`autoresync`
option to ``false``, the slave will not attempt an automatic resync more than
once in a ten minute period.
Sharded Cluster Options
~~~~~~~~~~~~~~~~~~~~~~~
.. setting:: configsvr
*Default:* false
Set this value to ``true`` to configure this :program:`mongod`
instance to operate as the :term:`config database` of a shard
cluster. When running with this option, clients will not be able to
write data to any database other than ``config`` and ``admin``. The
default port for a :program:`mongod` with this option is ``27019``
and the default :setting:`dbpath` directory is ``/data/configdb``,
unless specified.
.. versionchanged:: 2.2
:setting:`configsvr` also sets :setting:`smallfiles`.
.. versionchanged:: 2.4
:setting:`configsvr` creates a local :term:`oplog`.
Do not use :setting:`configsvr` with :setting:`replSet` or
:setting:`shardsvr`. Config servers cannot be a shard
server or part of a :term:`replica set`.
default port for :program:`mongod` with this option is ``27019``
and :program:`mongod` writes all data files to the ``/configdb``
sub-directory of the :setting:`dbpath` directory.
.. setting:: shardsvr
*Default:* false
Set this value to ``true`` to configure this :program:`mongod`
instance as a shard in a partitioned cluster. The default port for
these instances is ``27018``. The only effect of
:setting:`shardsvr` is to change the port number.
.. setting:: configdb
*Default:* None.
*Format:* ``<config1>,<config2><:port>,<config3>``
Set this option to specify a configuration database
(i.e. :term:`config database`) for the :term:`sharded cluster`. You
must specify either 1 configuration server or 3 configuration
servers, in a comma separated list.
This setting only affects :program:`mongos` processes.
.. note::
:program:`mongos` instances read from the first :term:`config
server <config database>` in the list provided. All
:program:`mongos` instances **must** specify the hosts to the
:setting:`configdb` setting in the same order.
If your configuration databases reside in more that one data
center, order the hosts in the :setting:`configdb` setting so
that the config database that is closest to the majority of your
:program:`mongos` instances is first servers in the list.
.. warning::
Never remove a config server from the :setting:`configdb` parameter, even if
the config server or servers are not available, or offline.
.. setting:: test
*Default:* false
Only runs unit tests and does not start a :program:`mongos` instance.
This setting only affects :program:`mongos` processes and is for
internal testing use only.
.. setting:: chunkSize
*Default:* 64
The value of this option determines the size of each :term:`chunk`
of data distributed around the :term:`sharded cluster`. The default
value is 64 megabytes. Larger chunks may lead to an uneven
distribution of data, while smaller chunks may lead to frequent and
unnecessary migrations. However, in some circumstances it may be
necessary to set a different chunk size.
This setting only affects :program:`mongos` processes. Furthermore,
:setting:`chunkSize` *only* sets the chunk size when initializing
the cluster for the first time. If you modify the run-time option
later, the new value will have no effect. See the
:doc:`/tutorial/modify-chunk-size-in-sharded-cluster` procedure if you
need to change the chunk size on an existing sharded cluster.
.. setting:: localThreshold
.. versionadded:: 2.2
:setting:`localThreshold` affects the logic that :program:`mongos`
uses when selecting :term:`replica set` members to pass reads
operations to from clients. Specify a value to
:setting:`localThreshold` in milliseconds. The default value is
``15``, which corresponds to the default value in all of the client
:doc:`drivers </applications/drivers>`.
This setting only affects :program:`mongos` processes.
When :program:`mongos` receives a request that permits reads to
:term:`secondary` members, the :program:`mongos` will:
- find the member of the set with the lowest ping time.
- construct a list of replica set members that is within a ping
time of 15 milliseconds of the nearest suitable member of the
set.
If you specify a value for :setting:`localThreshold`,
:program:`mongos` will construct the list of replica members
that are within the latency allowed by this value.
- The :program:`mongos` will select a member to read from at
random from this list.
The ping time used for a set member compared by the
:setting:`localThreshold` setting is a moving average of recent
ping times, calculated, at most, every 10 seconds. As a result,
some queries may reach members above the threshold until the
:program:`mongos` recalculates the average.
See the :ref:`replica-set-read-preference-behavior-member-selection`
section of the :doc:`read preference </core/read-preference>`
documentation for more information.
.. setting:: noAutoSplit
:setting:`noAutoSplit` is for internal use and is only available on
:program:`mongos` instances.
.. versionadded:: 2.0.7
:setting:`noAutoSplit` prevents :program:`mongos` from
automatically inserting metadata splits in a :term:`sharded
collection <sharding>`. If set on all :program:`mongos`, this will prevent
MongoDB from creating new chunks as the data in a collection
grows.
Because any :program:`mongos` in a cluster can create a split,
to totally disable splitting in a cluster you must
set :setting:`noAutoSplit` on all :program:`mongos`.
.. warning::
With :setting:`noAutoSplit` enabled, the data in your sharded
cluster may become imbalanced over time. Enable with caution.
.. setting:: moveParanoia
.. |move-paranoia-opt| replace:: :setting:`moveParanoia`
.. versionadded:: 2.4
.. include:: /includes/setting-moveparanoia.rst
SSL Options
~~~~~~~~~~~
.. |binary-name| replace:: :program:`mongod` or :program:`mongos`
.. include:: /includes/manpage-options-ssl-settings.rst