Skip to content

Commit 759bd80

Browse files
committed
DOCSP-49972 Updating all targets on connection targets page
1 parent 6141ba3 commit 759bd80

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

source/fundamentals/connections/connection-target.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,53 @@ code also uses the ``server_api`` field to specify a {+stable-api+} version.
5555
.. literalinclude:: /includes/fundamentals/code-snippets/srv.go
5656
:language: go
5757

58+
Local Deployments
59+
-----------------
5860

61+
.. include:: /includes/localhost-connection.rst
62+
63+
Replica Set
64+
-----------
65+
66+
A MongoDB replica set deployment is a group of connected instances that
67+
store the same set of data. This configuration provides data
68+
redundancy and high data availability.
69+
70+
To connect to a replica set deployment, specify the hostname and port numbers
71+
of each instance, separated by commas, and the replica set name as the value
72+
of the ``replicaSet`` parameter in the connection string. In the following
73+
example, the hostnames are ``host1``, ``host2``, and ``host3``, and the
74+
port numbers are all ``27017``. The replica set name is ``myRS``.
75+
76+
.. code-block:: none
77+
78+
mongodb://host1:27017,host2:27017,host3:27017/?replicaSet=myRS
79+
80+
When connecting to a replica set, the driver takes the following actions by default:
81+
82+
- Discovers all replica set members when given the address of any one member.
83+
- Dispatches operations to the appropriate member, such as instructions
84+
to write against the **primary**.
85+
86+
.. tip::
87+
88+
You can specify just one host to connect to a replica set.
89+
However, to ensure connectivity when the specified host
90+
is unavailable, you should provide the full list of hosts.
91+
92+
Direct Connection
93+
`````````````````
94+
95+
To force operations on the host designated in the connection URI,
96+
specify the ``directConnection`` option. Direct connections exhibit the
97+
following behavior:
98+
99+
- They don't support SRV strings.
100+
- They fail on writes when the specified host is not the **primary**.
101+
- They require you to specify a :manual:`secondary read preference
102+
</core/read-preference/#mongodb-readmode-secondary>` when the
103+
specified host isn't the **primary** node.
104+
105+
.. note:: Replica Set in Docker
106+
107+
.. sharedinclude:: dbx/docker-replica-set.rst

0 commit comments

Comments
 (0)