You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<kafka.version>2.4.1</kafka.version> // Replace with 3.2 if you're using HDInsight Kafka 3.2
161
+
<kafka.version>3.2.0</kafka.version> // Replace with 3.2 if you're using HDInsight Kafka 3.2
162
162
</properties>
163
163
<dependencies>
164
164
<dependency>
@@ -284,6 +284,19 @@ public class mssqlSinkToKafka {
284
284
}
285
285
```
286
286
287
+
### Submit job to Flink
288
+
289
+
* On Webssh pod
290
+
291
+
```
292
+
bin/flink run -c contoso.example.mssqlSinkToKafka -j FlinkSQLServerCDCDemo-1.0-SNAPSHOT.jar
293
+
Job has been submitted with JobID abccf644ae13a8028d7e232b85bd507f
294
+
```
295
+
* On Flink UI make the following change.
296
+
297
+
:::image type="content" source="./media/change-data-capture-connectors-for-apache-flink/flink-ui.png" alt-text="Screenshot showing the Flink UI.":::
298
+
299
+
287
300
### Validation
288
301
289
302
- Insert four rows into table order on sqlserver, then check on Kafka
@@ -306,7 +319,7 @@ public class mssqlSinkToKafka {
306
319
307
320
:::image type="content" source="./media/change-data-capture-connectors-for-apache-flink/check-changes-on-kafka-for-id-107.png" alt-text="Screenshot showing changes in Kafka for updated ID 107.":::
308
321
309
-
- Delete `product_id=107` on sqlserver
322
+
- Delete `product_id=107` on
310
323
311
324
:::image type="content" source="./media/change-data-capture-connectors-for-apache-flink/delete-product-id-107-on-sql-server.png" alt-text="Screenshot showing how to delete product ID 107.":::
Copy file name to clipboardExpand all lines: articles/hdinsight-aks/flink/datastream-api-mongodb.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
2
title: Use DataStream API for MongoDB as a source and sink with Apache Flink®
3
-
description: Learn how to use Apache Flink® DataStream API on HDInsight on AKS for MongoDB as a source and sink
3
+
description: Learn how to use Apache Flink® DataStream API on HDInsight on AKS for MongoDB as a source and sink.
4
4
ms.service: hdinsight-aks
5
5
ms.topic: how-to
6
-
ms.date: 10/30/2023
6
+
ms.date: 03/22/2024
7
7
---
8
8
9
9
# Use Apache Flink® DataStream API on HDInsight on AKS for MongoDB as a source and sink
@@ -12,24 +12,24 @@ ms.date: 10/30/2023
12
12
13
13
Apache Flink provides a MongoDB connector for reading and writing data from and to MongoDB collections with at-least-once guarantees.
14
14
15
-
This example demonstrates on how to use Apache Flink 1.16.0 on HDInsight on AKS along with your existing MongoDB as Sink and Source with Flink DataStream API MongoDB connector.
15
+
This example demonstrates on how to use Apache Flink 1.17.0 on HDInsight on AKS along with your existing MongoDB as Sink and Source with Flink DataStream API MongoDB connector.
16
16
17
-
MongoDB is a non-relational document database that provides support for JSON-like storage that helps store complex structures easily.
17
+
MongoDB is a nonrelational document database that provides support for JSON-like storage that helps store complex structures easily.
18
18
19
19
In this example, you learn how to use MongoDB to source and sink with DataStream API.
20
20
21
21
## Prerequisites
22
22
23
-
*[Flink cluster 1.16.0 on HDInsight on AKS](../flink/flink-create-cluster-portal.md)
23
+
*[HDInsight on AKS - Flink 1.17.0 Cluster](../flink/flink-create-cluster-portal.md)
24
24
* For this demonstration, use a Window VM as maven project develop env in the same VNET as HDInsight on AKS.
25
25
* We use the [MongoDB Connector](https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/connectors/datastream/mongodb/)
26
26
* For this demonstration, use an Ubuntu VM in the same VNET as HDInsight on AKS, install a MongoDB on this VM.
27
27
28
28
## Installation of MongoDB on Ubuntu VM
29
29
30
-
[Install MongoDB on Ubuntu](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/)
30
+
[Install MongoDB on Ubuntu](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/).
### Create a maven project on IdeaJ, to prepare the pom.xml for MongoDB Collection
100
+
### Create a maven project on IdeaJ to prepare the pom.xml for MongoDB Collection
101
101
102
102
```xml
103
103
<?xml version="1.0" encoding="UTF-8"?>
@@ -300,7 +300,7 @@ public class Event {
300
300
```
301
301
### Use MongoDB as a source and sink to ADLS Gen2
302
302
303
-
Write a program for MongoDB as a source and sink to ADLS Gen2
303
+
Write a program for MongoDB as a source and sink to ADLS Gen2.
304
304
305
305
**MongoDBSourceDemo.java**
306
306
```java
@@ -373,7 +373,7 @@ public class MongoDBSourceDemo {
373
373
```
374
374
### Package the maven jar, and submit to Apache Flink UI
375
375
376
-
Package the maven jar, upload it to Storage and then wget it to [Flink CLI](./flink-web-ssh-on-portal-to-flink-sql.md) or directly upload to Flink UI to run.
376
+
Package the maven jar, and upload it to Storage and then wget it to [Flink CLI](./flink-web-ssh-on-portal-to-flink-sql.md) or directly upload to Flink UI to run.
377
377
378
378
:::image type="content" source="./media/datastream-api-mongodb/step-3-1-maven-jar-upload-abfs.png" alt-text="Screenshot displays how to upload package to storage." border="true" lightbox="./media/datastream-api-mongodb/step-3-1-maven-jar-upload-abfs.png":::
### Package the jar and upload it into Webssh and submit the job:
206
206
207
-
Here, we use the packaged jar and submit to Flink cluster in HDInsight on AKS
207
+
`bin/flink run -c contoso.example.onelakeDemo -j OneLakeDemo-1.0-SNAPSHOT.jar`
208
208
209
-
:::image type="content" source="./media/fabric-lakehouse-flink-datastream-api/jar-submit-flink-step-1.png" alt-text="Screenshot showing How to submit packaged jar and submitting to Flink cluster - step 1." border="true" lightbox="./media/fabric-lakehouse-flink-datastream-api/jar-submit-flink-step-1.png":::
209
+
:::image type="content" source="./media/fabric-lakehouse-flink-datastream-api/package-the-jar-file.png" alt-text="Screenshot showing how to package the jar file." border="true" lightbox="./media/fabric-lakehouse-flink-datastream-api/package-the-jar-file.png":::
210
+
211
+
Check Job running on Flink UI:
212
+
213
+
214
+
:::image type="content" source="./media/fabric-lakehouse-flink-datastream-api/check-job-runs-on-flink-ui.png" alt-text="Screenshot showing how to check job runs on Flink UI." border="true" lightbox="./media/fabric-lakehouse-flink-datastream-api/check-job-runs-on-flink-ui.png":::
210
215
211
-
:::image type="content" source="./media/fabric-lakehouse-flink-datastream-api/jar-submit-flink-step-2.png" alt-text="Screenshot showing How to submit packaged jar and submitting to Flink cluster - step 2." border="true" lightbox="./media/fabric-lakehouse-flink-datastream-api/jar-submit-flink-step-2.png":::
0 commit comments