-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
mongos.txt
1559 lines (976 loc) · 53.4 KB
/
mongos.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
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.. _mongos:
==========
``mongos``
==========
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Synopsis
--------
:binary:`~bin.mongos` for "MongoDB Shard," is a routing service for
MongoDB shard configurations that processes queries from the
application layer, and determines the location of this data in the
:term:`sharded cluster`, in order to complete these operations.
From the perspective of the application, a
:binary:`~bin.mongos` instance behaves identically to any other MongoDB
instance.
.. seealso:: :ref:`conf-file-command-line-mapping`
.. note::
.. include:: /includes/fact-tls-1.0.rst
.. |binary| replace:: MongoDB
Considerations
--------------
Never change the name of the :binary:`~bin.mongos` binary.
Options
-------
.. only:: (not man)
.. class:: hidden
.. binary:: mongos
Core Options
~~~~~~~~~~~~
.. program:: mongos
.. option:: --help, -h
Returns information on the options and use of :program:`mongos`.
.. option:: --version
Returns the :program:`mongos` release number.
.. option:: --config <filename>, -f <filename>
Specifies a configuration file for runtime configuration options. The
configuration file is the preferred method for runtime configuration of
:program:`mongos`. The options are equivalent to the command-line
configuration options. See :doc:`/reference/configuration-options` for
more information.
Ensure the configuration file uses ASCII encoding. The :program:`mongos`
instance does not support configuration files with non-ASCII encoding,
including UTF-8.
.. option:: --verbose, -v
Increases the amount of internal reporting returned on standard output
or in log files. Increase the verbosity with the ``-v`` form by
including the option multiple times, (e.g. ``-vvvvv``.)
.. option:: --quiet
Runs :program:`mongos` in a quiet mode that attempts to limit the amount
of output.
This option suppresses:
- output from :term:`database commands <database command>`
- replication activity
- connection accepted events
- connection closed events
.. option:: --port <port>
*Default*: 27017
The TCP port on which the :binary:`~bin.mongos` instance listens for
client connections.
.. option:: --bind_ip <hostnames|ipaddresses|Unix domain socket paths>
*Default*: localhost
.. note::
Starting in MongoDB 3.6, :program:`mongos` bind to localhost
by default. See :ref:`3.6-bind-to-localhost`.
The hostnames and/or IP addresses and/or full Unix domain socket
paths on which :program:`mongos` should listen for client connections. You
may attach :program:`mongos` to any interface. To bind to multiple
addresses, enter a list of comma-separated values.
.. example:: ``localhost,/tmp/mongod.sock``
You can specify both IPv4 and IPv6 addresses, or hostnames that
resolve to an IPv4 or IPv6 address.
.. example:: ``localhost, 2001:0DB8:e132:ba26:0d5c:2774:e7f9:d513``
.. note::
If specifying an IPv6 address *or* a hostname that resolves to an
IPv6 address to :option:`--bind_ip`, you must start :program:`mongos` with
:option:`--ipv6` to enable IPv6 support. Specifying an IPv6 address
to :option:`--bind_ip` does not enable IPv6 support.
If specifying a
`link-local IPv6 address <https://en.wikipedia.org/w/index.php?title=Link-local_address&oldid=880793020#IPv6>`_
(``fe80::/10``), you must append the
`zone index <https://en.wikipedia.org/w/index.php?title=IPv6_address&oldid=877601778#Scoped_literal_IPv6_addresses>`_
to that address (i.e. ``fe80::<address>%<adapter-name>``).
.. example:: ``localhost,fe80::a00:27ff:fee0:1fcf%enp0s3``
.. include:: /includes/tip-hostnames.rst
.. include:: /includes/warning-bind-ip-security-considerations.rst
For more information about IP Binding, refer to the
:doc:`/core/security-mongodb-configuration` documentation.
To bind to all IPv4 addresses, enter ``0.0.0.0``.
To bind to all IPv4 and IPv6 addresses, enter ``::,0.0.0.0``
or alternatively, use the :setting:`net.bindIpAll` setting.
.. note::
``--bind_ip`` and ``--bind_ip_all`` are mutually exclusive.
Specifying both options causes :program:`mongos` to throw an error and
terminate.
.. option:: --bind_ip_all
.. versionadded:: 3.6
If specified, the :program:`mongos` instance binds to all IPv4
addresses (i.e. ``0.0.0.0``). If :program:`mongos` starts with
:option:`--ipv6`, :option:`--bind_ip_all` also binds to all IPv6 addresses
(i.e. ``::``).
:program:`mongos` only supports IPv6 if started with :option:`--ipv6`. Specifying
:option:`--bind_ip_all` alone does not enable IPv6 support.
.. include:: /includes/warning-bind-ip-security-considerations.rst
For more information about IP Binding, refer to the
:doc:`/core/security-mongodb-configuration` documentation.
Alternatively, you can set the ``--bind_ip`` option to
``::,0.0.0.0`` to bind to all IP addresses.
.. note::
``--bind_ip`` and ``--bind_ip_all`` are mutually exclusive. That
is, you can specify one or the other, but not both.
.. option:: --maxConns <number>
The maximum number of simultaneous connections that :program:`mongos` will
accept. This setting has no effect if it is higher than your operating
system's configured maximum connection tracking threshold.
Do not assign too low of a value to this option, or you will
encounter errors during normal application operation.
.. include:: /includes/fact-maxconns-mongos.rst
.. include:: /includes/note-max-conns-max.rst
.. option:: --syslog
Sends all logging output to the host's :term:`syslog` system rather
than to standard output or to a log file. , as with :option:`--logpath`.
The :option:`--syslog` option is not supported on Windows.
.. warning::
The ``syslog`` daemon generates timestamps when it logs a message, not
when MongoDB issues the message. This can lead to misleading timestamps
for log entries, especially when the system is under heavy load. We
recommend using the :option:`--logpath` option for production systems to
ensure accurate timestamps.
.. option:: --syslogFacility <string>
*Default*: user
Specifies the facility level used when logging messages to syslog.
The value you specify must be supported by your
operating system's implementation of syslog. To use this option, you
must enable the :option:`--syslog` option.
.. option:: --logpath <path>
Sends all diagnostic logging information to a log file instead of to
standard output or to the host's :term:`syslog` system. MongoDB creates
the log file at the path you specify.
By default, MongoDB will move any existing log file rather than overwrite
it. To instead append to the log file, set the :option:`--logappend` option.
.. option:: --logappend
Appends new entries to the end of the existing log file when the :program:`mongos`
instance restarts. Without this option, :binary:`~bin.mongod` will back up the
existing log and create a new file.
.. option:: --logRotate <string>
*Default*: rename
Determines the behavior for the :dbcommand:`logRotate` command.
Specify either ``rename`` or ``reopen``:
- ``rename`` renames the log file.
- ``reopen`` closes and reopens the log file following the typical
Linux/Unix log rotate behavior. Use ``reopen`` when using the
Linux/Unix logrotate utility to avoid log loss.
If you specify ``reopen``, you must also use :option:`--logappend`.
If :doc:`auditing </core/auditing>` is enabled, the
:dbcommand:`logRotate` command also rotates the audit log according
to the above parameters. For example, if :option:`--logRotate` is set
to ``rename``, the audit log will also be renamed.
.. option:: --redactClientLogData
.. versionadded:: 3.4 Available in MongoDB Enterprise only.
A :program:`mongos` running with :option:`--redactClientLogData` redacts any message accompanying a given
log event before logging. This prevents the :program:`mongos` from writing
potentially sensitive data stored on the database to the diagnostic log.
Metadata such as error or operation codes, line numbers, and source file
names are still visible in the logs.
Use :option:`--redactClientLogData` in conjunction with
:doc:`/core/security-encryption-at-rest` and
:doc:`/core/security-transport-encryption` to assist compliance with
regulatory requirements.
For example, a MongoDB deployment might store Personally Identifiable
Information (PII) in one or more collections. The :program:`mongos` logs events
such as those related to CRUD operations, sharding metadata, etc. It is
possible that the :program:`mongos` may expose PII as a part of these logging
operations. A :program:`mongos` running with :option:`--redactClientLogData` removes any message
accompanying these events before being output to the log, effectively
removing the PII.
Diagnostics on a :program:`mongos` running with :option:`--redactClientLogData` may be more difficult
due to the lack of data related to a log event. See the
:ref:`process logging <monitoring-log-redaction>` manual page for an
example of the effect of :option:`--redactClientLogData` on log output.
On a running :program:`mongos`, use :dbcommand:`setParameter` with the
:parameter:`redactClientLogData` parameter to configure this setting.
.. option:: --timeStampFormat <string>
*Default*: iso8601-local
The time format for timestamps in log messages. Specify one of the
following values:
.. list-table::
:header-rows: 1
:widths: 20 40
* - Value
- Description
* - ``ctime``
- Displays timestamps as ``Wed Dec 31
18:17:54.811``.
* - ``iso8601-utc``
- Displays timestamps in Coordinated Universal Time (UTC) in the
ISO-8601 format. For example, for New York at the start of the
Epoch: ``1970-01-01T00:00:00.000Z``
* - ``iso8601-local``
- Displays timestamps in local time in the ISO-8601
format. For example, for New York at the start of the Epoch:
``1969-12-31T19:00:00.000-0500``
.. option:: --pidfilepath <path>
Specifies a file location to store the process ID (PID) of the :program:`mongos`
process. The user running the ``mongod`` or ``mongos``
process must be able to write to this path. If the :option:`--pidfilepath` option is not
specified, the process does not create a PID file. This option is generally
only useful in combination with the :option:`--fork` option.
.. admonition:: Linux
:class: note
On Linux, PID file management is generally the responsibility of
your distro's init system: usually a service file in the ``/etc/init.d``
directory, or a systemd unit file registered with ``systemctl``. Only
use the :option:`--pidfilepath` option if you are not using one of these init
systems. For more information, please see the respective
:doc:`Installation Guide </installation>` for your operating system.
.. admonition:: macOS
:class: note
On macOS, PID file management is generally handled by ``brew``. Only use
the :option:`--pidfilepath` option if you are not using ``brew`` on your macOS system.
For more information, please see the respective
:doc:`Installation Guide </installation>` for your operating system.
.. option:: --keyFile <file>
Specifies the path to a key file that stores the shared secret
that MongoDB instances use to authenticate to each other in a
:term:`sharded cluster` or :term:`replica set`. :option:`--keyFile` implies
``client authorization``. See :ref:`inter-process-auth` for more
information.
.. option:: --setParameter <options>
Specifies one of the MongoDB parameters described in
:doc:`/reference/parameters`. You can specify multiple ``setParameter``
fields.
.. option:: --nounixsocket
Disables listening on the UNIX domain socket. :option:`--nounixsocket` applies only
to Unix-based systems.
The :program:`mongos` process
always listens on the UNIX socket unless one of the following is true:
- :option:`--nounixsocket` is set
- :setting:`net.bindIp` is not set
- :setting:`net.bindIp` does not specify ``localhost`` or its associated IP address
.. |mongodb-package| replace:: :program:`mongos`
.. include:: /includes/note-deb-and-rpm-default-to-localhost.rst
.. option:: --unixSocketPrefix <path>
*Default*: /tmp
The path for the UNIX socket. :option:`--unixSocketPrefix` applies only
to Unix-based systems.
If this option has no value, the
:program:`mongos` process creates a socket with ``/tmp`` as a prefix. MongoDB
creates and listens on a UNIX socket unless one of the following is true:
- :setting:`net.unixDomainSocket.enabled` is ``false``
- :option:`--nounixsocket` is set
- :setting:`net.bindIp` is not set
- :setting:`net.bindIp` does not specify ``localhost`` or its associated IP address
.. option:: --filePermissions <path>
*Default*: ``0700``
Sets the permission for the UNIX domain socket file.
:option:`--filePermissions` applies only to Unix-based systems.
.. option:: --fork
Enables a :term:`daemon` mode that runs the :program:`mongos` process in the
background. By default :program:`mongos` does not run as a daemon:
typically you will run :program:`mongos` as a daemon, either by using
:option:`--fork` or by using a controlling process that handles the
daemonization process (e.g. as with ``upstart`` and ``systemd``).
Using the :option:`--fork` option requires that you configure log
output for the :program:`mongos` with one of the following:
- :option:`--logpath`
- :option:`--syslog`
The :option:`--fork` option is not supported on Windows.
.. option:: --transitionToAuth
.. versionadded:: 3.4
Allows the :program:`mongos` to accept and create authenticated and
non-authenticated connections to and from other :binary:`~bin.mongod`
and :binary:`~bin.mongos` instances in the deployment. Used for
performing rolling transition of replica sets or sharded clusters
from a no-auth configuration to :ref:`internal authentication
<inter-process-auth>`. Requires specifying a :ref:`internal
authentication <inter-process-auth>` mechanism such as
:option:`--keyFile`.
For example, if using :ref:`keyfiles <internal-auth-keyfile>` for
:ref:`internal authentication <inter-process-auth>`, the :program:`mongos` creates
an authenticated connection with any :binary:`~bin.mongod` or :binary:`~bin.mongos`
in the deployment using a matching keyfile. If the security mechanisms do
not match, the :program:`mongos` utilizes a non-authenticated connection instead.
A :program:`mongos` running with :option:`--transitionToAuth` does not enforce :ref:`user access
controls <authorization>`. Users may connect to your deployment without any
access control checks and perform read, write, and administrative operations.
.. note::
A :program:`mongos` running with :ref:`internal authentication
<inter-process-auth>` and *without* :option:`--transitionToAuth` requires clients to connect
using :ref:`user access controls <authorization>`. Update clients to
connect to the :program:`mongos` using the appropriate :ref:`user <users>`
prior to restarting :program:`mongos` without :option:`--transitionToAuth`.
.. option:: --networkMessageCompressors <string>
*Default*: snappy
.. versionadded:: 3.4
Specifies the default compressor(s) to use for
communication between this :program:`mongos` instance and:
- other members of the sharded cluster
- a :binary:`~bin.mongo` shell
- drivers that support the ``OP_COMPRESSED`` message format.
MongoDB supports the following compressors:
- :term:`snappy`
- :term:`zlib` (Available in MongoDB 3.6 or greater)
**In versions 3.6 and 4.0**, :binary:`~bin.mongod` and
:binary:`~bin.mongos` enable network compression by default with
``snappy`` as the compressor.
To disable network compression, set the value to ``disabled``.
.. include:: /includes/fact-networkMessageCompressors.rst
.. option:: --serviceExecutor <string>
*Default*: synchronous
.. versionadded:: 3.6
Determines the threading and execution model :program:`mongos` uses to
execute client requests. The ``--serviceExecutor`` option accepts one
of the following values:
.. list-table::
:header-rows: 1
:widths: 20 40
* - Value
- Description
* - ``synchronous``
- The :program:`mongos` uses synchronous networking and manages its
networking thread pool on a per connection basis. Previous
versions of MongoDB managed threads in this way.
* - ``adaptive``
- The :program:`mongos` uses the new experimental asynchronous
networking mode with an adaptive thread pool which manages
threads on a per request basis. This mode should have more
consistent performance and use less resources when there are
more inactive connections than database requests.
.. option:: --timeZoneInfo <path>
.. include:: /includes/fact-timeZoneInfo.rst
.. code-block:: sh
wget https://downloads.mongodb.org/olson_tz_db/timezonedb-latest.zip
unzip timezonedb-latest.zip
mongos --timeZoneInfo timezonedb-2017b/
.. include:: /includes/warning-timeZoneInfo.rst
Sharded Cluster Options
~~~~~~~~~~~~~~~~~~~~~~~
.. option:: --configdb <replicasetName>/<config1>,<config2>...
.. versionchanged:: 3.2
Specifies the :ref:`configuration servers <sharding-config-server>` for the
:term:`sharded cluster`.
.. include:: /includes/fact-mirrored-config-servers-deprecated.rst
Specify the config server replica set name and the hostname and port of
at least one of the members of the config server replica set.
.. code-block:: javascript
sharding:
configDB: <configReplSetName>/cfg1.example.net:27019, cfg2.example.net:27019,...
The :binary:`~bin.mongos` instances for the sharded cluster must specify
the same config server replica set name but can specify hostname and
port of different members of the replica set.
.. option:: --localThreshold
*Default*: 15
Specifies the ping time, in milliseconds, that :binary:`~bin.mongos` uses
to determine which secondary replica set members to pass read
operations from clients. The default value of ``15`` corresponds to
the default value in all of the client :ecosystem:`drivers
</drivers>`.
When :binary:`~bin.mongos` receives a request that permits reads to
:term:`secondary` members, the :binary:`~bin.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 the :option:`--localThreshold` option, :binary:`~bin.mongos` will
construct the list of replica members that are within the latency
allowed by this value.
- Select a member to read from at random from this list.
The ping time used for a member compared by the :option:`--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 :binary:`~bin.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.
TLS/SSL Options
~~~~~~~~~~~~~~~
.. see:: :doc:`/tutorial/configure-ssl` for full
documentation of MongoDB's support.
.. option:: --sslOnNormalPorts
.. deprecated:: 2.6 Use :option:`--sslMode requireSSL <--sslMode>` instead.
Enables TLS/SSL for :program:`mongos`.
With :option:`--sslOnNormalPorts`, a :program:`mongos` requires TLS/SSL encryption for all
connections on the default MongoDB port, or the port specified by
:option:`--port`. By default, :option:`--sslOnNormalPorts` is
disabled.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslMode <mode>
.. versionadded:: 2.6
Enables TLS/SSL or mixed TLS/SSL used for all network connections. The
argument to the :option:`--sslMode` option can be one of the following:
.. list-table::
:header-rows: 1
:widths: 20 40
* - Value
- Description
* - ``disabled``
- The server does not use TLS/SSL.
* - ``allowSSL``
- Connections between servers do not use TLS/SSL. For incoming
connections, the server accepts both TLS/SSL and non-TLS/non-SSL.
* - ``preferSSL``
- Connections between servers use TLS/SSL. For incoming
connections, the server accepts both TLS/SSL and non-TLS/non-SSL.
* - ``requireSSL``
- The server uses and accepts only TLS/SSL encrypted connections.
.. include:: /includes/extracts/ssl-facts-ca-file.rst
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslPEMKeyFile <filename>
.. note::
Starting in 4.0, on macOS or Windows, you can use a certificate from
the operating system's secure store instead of a PEM key file. See
:option:`--sslCertificateSelector`.
Specifies the :file:`.pem` file that contains both the TLS/SSL certificate
and key.
- On Linux/BSD, you must specify :option:`--sslPEMKeyFile` when TLS/SSL is enabled.
- On Windows or macOS, you must specify either :option:`--sslPEMKeyFile` or
:option:`--sslCertificateSelector` when TLS/SSL is enabled.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslPEMKeyPassword <value>
Specifies the password to de-crypt the certificate-key file (i.e.
:option:`--sslPEMKeyFile`). Use the :option:`--sslPEMKeyPassword` option only if the
certificate-key file is encrypted. In all cases, the :program:`mongos` will
redact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the PEM file is encrypted and
you do not specify the :option:`--sslPEMKeyPassword` option, MongoDB will prompt for a
passphrase. See :ref:`ssl-certificate-password`.
- On macOS or Windows, if the private key in the PEM file is
encrypted, you must explicitly specify the :option:`--sslPEMKeyPassword` option.
Alternatively, you can use a certificate from the secure system
store (see :option:`--sslCertificateSelector`) instead of a PEM key file or use an
unencrypted PEM file.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --clusterAuthMode <option>
*Default*: keyFile
.. versionadded:: 2.6
The authentication mode used for cluster authentication. If you use
:ref:`internal x.509 authentication <x509-internal-authentication>`,
specify so here. This option can have one of the following values:
.. list-table::
:header-rows: 1
:widths: 20 40
* - Value
- Description
* - ``keyFile``
- Use a keyfile for authentication.
Accept only keyfiles.
* - ``sendKeyFile``
- For rolling upgrade purposes. Send a keyfile for
authentication but can accept both keyfiles and x.509
certificates.
* - ``sendX509``
- For rolling upgrade purposes. Send the x.509 certificate for
authentication but can accept both keyfiles and x.509
certificates.
* - ``x509``
- Recommended. Send the x.509 certificate for authentication and
accept only x.509 certificates.
.. include:: /includes/extracts/ssl-facts-ca-file.rst
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslClusterFile <filename>
.. note::
Starting in 4.0, on macOS or Windows, you can use a certificate
from the operating system's secure store instead of a PEM key
file. See :option:`--sslClusterCertificateSelector`.
Specifies the :file:`.pem` file that contains the x.509 certificate-key
file for :ref:`membership authentication <x509-internal-authentication>`
for the cluster or replica set.
If :option:`--sslClusterFile` does not specify the ``.pem`` file for internal cluster
authentication or the alternative
:option:`--sslClusterCertificateSelector`, the cluster uses the
``.pem`` file specified in the :option:`--sslPEMKeyFile` option or
the certificate returned by the :option:`--sslCertificateSelector`.
.. include:: /includes/extracts/ssl-facts-x509-ca-file.rst
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslClusterPassword <value>
.. versionadded:: 2.6
Specifies the password to de-crypt the x.509 certificate-key file
specified with ``--sslClusterFile``. Use the :option:`--sslClusterPassword` option only
if the certificate-key file is encrypted. In all cases, the :program:`mongos`
will redact the password from all logging and reporting output.
Starting in MongoDB 4.0:
- On Linux/BSD, if the private key in the x.509 file is encrypted and
you do not specify the :option:`--sslClusterPassword` option, MongoDB will prompt for a
passphrase. See :ref:`ssl-certificate-password`.
- On macOS or Windows, if the private key in the x.509 file is
encrypted, you must explicitly specify the :option:`--sslClusterPassword` option.
Alternatively, you can either use a certificate from the secure
system store (see :option:`--sslClusterCertificateSelector`) instead of a cluster PEM file or
use an unencrypted PEM file.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslCAFile <filename>
Specifies the :file:`.pem` file that contains the root certificate chain
from the Certificate Authority. Specify the file name of the
:file:`.pem` file using relative or absolute paths.
Starting in 4.0, on macOS or Windows, you can use a certificate from
the operating system's secure store instead of a PEM key file. See
:option:`--sslCertificateSelector`. When using the secure store, you
do not need to, but can, also specify the :option:`--sslCAFile`.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslClusterCAFile <filename>
.. versionadded:: 4.0.3
Specifies the :file:`.pem` file that contains the root certificate chain
from the Certificate Authority used to validate the certificate
presented by a client establishing a connection. Specify the file
name of the :file:`.pem` file using relative or absolute paths.
If :option:`--sslClusterCAFile` does not specify the :file:`.pem` file for validating the
certificate from a client establishing a connection, the cluster uses
the :file:`.pem` file specified in the :option:`--sslCAFile` option.
:option:`--sslClusterCAFile` lets you use separate Certificate Authorities to verify the
client to server and server to client portions of the TLS handshake.
Starting in 4.0, on macOS or Windows, you can use a certificate from
the operating system's secure store instead of a PEM key file. See
:option:`--sslClusterCertificateSelector`. When using the secure store, you
do not need to, but can, also specify the :option:`--sslClusterCAFile`.
Requires that :option:`--sslCAFile` is set.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslCertificateSelector <parameter>=<value>
.. versionadded:: 4.0
Available on Windows and macOS as an alternative to :option:`--sslPEMKeyFile`.
:option:`--sslPEMKeyFile` and :option:`--sslCertificateSelector` options are mutually exclusive. You can only
specify one.
Specifies a certificate property in order to select a matching
certificate from the operating system's certificate store.
:option:`--sslCertificateSelector` accepts an argument of the format ``<property>=<value>``
where the property can be one of the following:
.. include:: /includes/extracts/ssl-facts-certificate-selector-properties.rst
.. include:: /includes/extracts/ssl-facts-certificate-selector-revocation.rst
.. option:: --sslClusterCertificateSelector <parameter>=<value>
.. versionadded:: 4.0
Available on Windows and macOS as an alternative to
:option:`--sslClusterFile`.
:option:`--sslClusterFile` and :option:`--sslClusterCertificateSelector` options are mutually exclusive. You can only
specify one.
Specifies a certificate property in order to select a matching
certificate from the operating system's certificate store to use for
internal authentication.
:option:`--sslClusterCertificateSelector` accepts an argument of the format ``<property>=<value>``
where the property can be one of the following:
.. include:: /includes/extracts/ssl-facts-certificate-selector-properties.rst
.. option:: --sslCRLFile <filename>
Specifies the :file:`.pem` file that contains the Certificate Revocation
List. Specify the file name of the :file:`.pem` file using relative or
absolute paths.
.. note::
Starting in MongoDB 4.0, you cannot specify :option:`--sslCRLFile` on macOS. Use :option:`--sslCertificateSelector` instead.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslAllowConnectionsWithoutCertificates
For clients that do not present certificates, :program:`mongos` bypasses
TLS/SSL certificate validation when establishing the connection.
For clients that present a certificate, however, :program:`mongos` performs
certificate validation using the root certificate chain specified by
``--sslCAFile`` and reject clients with invalid certificates.
Use the :option:`--sslAllowConnectionsWithoutCertificates` option if you have a mixed deployment that includes
clients that do not or cannot present certificates to the :program:`mongos`.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslAllowInvalidCertificates
Bypasses the validation checks for TLS/SSL certificates on other
servers in the cluster and allows the use of invalid certificates to
connect.
.. note::
.. include:: /includes/extracts/ssl-facts-x509-invalid-certificate.rst
When using
the :option:`--sslAllowInvalidCertificates` setting, MongoDB
logs a warning regarding the use of the invalid certificate.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslAllowInvalidHostnames
.. versionadded:: 3.0
Disables the validation of the hostnames in TLS/SSL certificates,
when connecting to other members of the replica set or sharded cluster
for inter-process authentication. This allows :program:`mongos` to connect
to other members if the hostnames in their certificates do not match
their configured hostname.
.. include:: /includes/extracts/ssl-facts-see-more.rst
.. option:: --sslDisabledProtocols <protocol(s)>
.. versionadded:: 3.0.7
Prevents a MongoDB server running with TLS/SSL from accepting
incoming connections that use a specific protocol or protocols. To
specify multiple protocols, use a comma separated list of protocols.
:option:`--sslDisabledProtocols` recognizes the following protocols: ``TLS1_0``, ``TLS1_1``,
``TLS1_2``, and starting in version 4.0.4 (and 3.6.9), ``TLS1_3``.
- On macOS, you cannot disable ``TLS1_1`` and leave both ``TLS1_0`` and
``TLS1_2`` enabled. You must disable at least one of the other
two, for example, ``TLS1_0,TLS1_1``.
- To list multiple protocols, specify as a comma separated list of
protocols. For example ``TLS1_0,TLS1_1``.
- Specifying an unrecognized protocol will prevent the server from
starting.
- The specified disabled protocols overrides any default disabled
protocols.
Starting in version 4.0, MongoDB disables the use of TLS 1.0 if TLS
1.1+ is available on the system. To enable the disabled TLS 1.0,
specify ``none`` to :option:`--sslDisabledProtocols`. See :ref:`4.0-disable-tls`.
Members of replica sets and sharded clusters must speak at least one
protocol in common.
.. seealso:: :ref:`ssl-disallow-protocols`
.. option:: --sslFIPSMode
Directs the :program:`mongos` to use the FIPS mode of the TLS/SSL
library. Your system must have a FIPS
compliant library to use the :option:`--sslFIPSMode` option.
.. include:: /includes/note-fips-is-enterprise-only.rst
Audit Options
~~~~~~~~~~~~~