Skip to content

Commit 41413fc

Browse files
biniona-mongodbjwilliams-mongoRWaltersMA
authored andcommitted
(DOCSP-17836) Connect to MongoDB (#157)
Co-authored-by: John Williams <[email protected]> Co-authored-by: Robert Walters <[email protected]>
1 parent ec4cf0a commit 41413fc

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

snooty.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ toc_landing_pages = ["/sink-connector", "/sink-connector/configuration-propertie
77
mkc = "MongoDB Kafka Connector"
88
ak = "Apache Kafka"
99
kc = "Kafka Connect"
10+
connector_version="1.6"
11+
connector_driver_version="4.3"
12+
connector_driver_url_base="https://docs.mongodb.com/drivers/java/sync/v{+connector_driver_version+}/"

source/introduction.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Introduction
66
:titlesonly:
77

88
Kafka and Kafka Connect </introduction/kafka-connect>
9-
Key Concepts </introduction/key-concepts>
9+
Connect to MongoDB </introduction/connect>
1010
Data Formats </introduction/data-formats>
1111
Converters </introduction/converters>
1212

source/introduction/connect.txt

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
==================
2+
Connect to MongoDB
3+
==================
4+
5+
.. default-domain:: mongodb
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 2
11+
:class: singlecol
12+
13+
Overview
14+
--------
15+
16+
Learn how to connect the {+mkc+} to MongoDB using a
17+
**connection Uniform Resource Identifier (URI)**. A connection URI is a
18+
string that contains the following information:
19+
20+
- The address of your MongoDB deployment *required*
21+
- Connection settings *optional*
22+
- Authentication settings *optional*
23+
- Authentication credentials *optional*
24+
25+
The following is an example of a connection URI for a MongoDB replica set:
26+
27+
.. code-block:: text
28+
29+
mongodb://mongodb0.example.com:27017,mongodb1.example.com:27017,mongodb2.example.com:27017/?replicaSet=myRepl
30+
31+
To learn more about the connection URI format, see
32+
:manual:`Connection String URI Format </reference/connection-string/>` in the MongoDB Manual.
33+
34+
How to Connect
35+
--------------
36+
37+
Specify a connection URI with the following configuration option in both
38+
a source and sink connector:
39+
40+
.. code-block:: properties
41+
42+
connection.uri=<your connection uri>
43+
44+
To learn more about this configuration option, see the following resources:
45+
46+
- :doc:`Source connector configuration options </source-connector/configuration-properties/mongodb-connection/>`
47+
- :doc:`Sink connector configuration options </sink-connector/configuration-properties/mongodb-connection/>`
48+
49+
Connection URI Options
50+
----------------------
51+
52+
The {+mkc+} uses the **MongoDB Java driver** to parse your connection URI.
53+
The MongoDB Java driver is an artifact that enables Java applications like {+kc+}
54+
to interact with MongoDB.
55+
56+
.. important:: Driver Version
57+
58+
Version {+connector_version+} of the {+mkc+} uses version
59+
{+connector_driver_version+} of the MongoDB Java driver.
60+
61+
To learn what connection URI options are available in the {+mkc+}, see
62+
`the MongoDB Java driver Connection guide <{+connector_driver_url_base+}fundamentals/connection/#connection-options>`__.
63+
64+
Authentication
65+
~~~~~~~~~~~~~~
66+
67+
All authentication mechanisms available in the MongoDB Java driver are available
68+
in the {+mkc+}.
69+
70+
The following is an example of a connection URI that authenticates with MongoDB using
71+
``SCRAM-SHA-256`` authentication:
72+
73+
.. code-block:: text
74+
75+
mongodb://<username>:<password>@<hostname>:<port>/?authSource=<authenticationDb>&authMechanism=SCRAM-SHA-256
76+
77+
.. important:: Load Secrets
78+
79+
To avoid storing your authentication secrets as plain text in your ``connection.uri``
80+
setting, load your secrets from a secure location as your connector starts.
81+
To learn how to load your secrets as your connector starts, see
82+
`the Externalize Secrets guide from Confluent <https://docs.confluent.io/platform/current/connect/security.html#externalizing-secrets>`__.
83+
84+
To learn what authentication mechanisms are available, see
85+
`the MongoDB Java driver Authentication Mechanisms guide <{+connector_driver_url_base+}fundamentals/auth/#mechanisms>`__.
86+
87+
To learn more about authentication in the {+mkc+}, see the
88+
:doc:`Security and Authentication guide </security-and-authentication>`.

0 commit comments

Comments
 (0)