Skip to content

Commit 79419fb

Browse files
committed
Add Kafka Connect
1 parent d551a2e commit 79419fb

File tree

11 files changed

+90
-11
lines changed

11 files changed

+90
-11
lines changed

benchmarks/bench-mongo-kafka-cdc/mongo-kafka.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ tools:
1111
docker-compose: ../tools/docker-compose-conduit.yml
1212

1313
metrics:
14-
conduit:
14+
conduit_metrics:
1515
collector: conduit # type of the collector, one of: conduit, prometheus, kafka, docker
1616
tools:
1717
- conduit
@@ -35,22 +35,44 @@ tests:
3535
/scripts/init_db.sh
3636
pre-tool:
3737
post-tool:
38-
- name: "Install curl"
38+
- name: "Conduit: Install tools"
39+
tools:
40+
- conduit
3941
container: "benchi-conduit"
4042
run: |-
41-
/app/scripts/install_curl.sh
42-
- name: "Set up CDC"
43+
/scripts/install_tools.sh
44+
45+
- name: "Conduit: Set up CDC"
46+
tools:
47+
- conduit
4348
container: "benchi-conduit"
4449
run: |-
45-
/app/scripts/start_pipeline.sh && /app/scripts/stop_pipeline.sh
50+
/scripts/start_pipeline.sh && /scripts/stop_pipeline.sh
51+
- name: "Kafka Connect: Set up CDC"
52+
tools:
53+
- kafka-connect
54+
container: "benchi-kafka-connect"
55+
run: |-
56+
/scripts/create_stopped_pipeline.sh
57+
4658
- name: "Insert test data"
4759
container: "mongo1"
4860
run: |
4961
/scripts/insert_test_data.sh
50-
- name: "Start pipeline"
62+
63+
- name: "Conduit: start pipeline"
64+
tools:
65+
- conduit
5166
container: "benchi-conduit"
5267
run: |-
53-
/app/scripts/start_pipeline.sh
68+
/scripts/start_pipeline.sh
69+
70+
- name: "KC: start pipeline"
71+
tools:
72+
- kafka-connect
73+
container: "benchi-kafka-connect"
74+
run: |-
75+
/scripts/start_pipeline.sh
5476
pre-test:
5577
during:
5678
post-test:

benchmarks/infra/docker-compose-kafka.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ services:
1919
retries: 5
2020
start_period: 30s
2121
ports:
22+
- "9092:9092"
2223
- "7071:7071"
2324
volumes:
2425
- ./kafka/jmx:/opt/kafka/jmx # Mount JMX files

benchmarks/infra/mongo/scripts/insert-test-users.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const browsers = ['Chrome', 'Firefox', 'Safari', 'Edge'];
99

1010

1111
// Total number of documents and batch size
12-
const totalDocs = 2_000_000;
12+
const totalDocs = 20_000;
1313
const batchSize = 20_000;
1414
let batch = [];
1515

File renamed without changes.

benchmarks/tools/docker-compose-conduit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
environment:
1010
CONDUIT_LOG_FORMAT: json
1111
volumes:
12-
- ./conduit-scripts:/app/scripts
12+
- ./conduit-scripts:/scripts
1313

1414
networks:
1515
benchi:

benchmarks/tools/docker-compose-kafka-connect.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ services:
77
ports:
88
- "8083:8083"
99
environment:
10-
CONNECT_BOOTSTRAP_SERVERS: "benchi-kafka:29092"
10+
CONNECT_BOOTSTRAP_SERVERS: "benchi-kafka:9092"
1111
CONNECT_REST_ADVERTISED_HOST_NAME: benchi-kafka-connect
1212
CONNECT_REST_PORT: 8083
1313
CONNECT_GROUP_ID: connect-cluster-group
@@ -25,7 +25,12 @@ services:
2525
CONNECT_KEY_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
2626
CONNECT_VALUE_CONVERTER: "org.apache.kafka.connect.json.JsonConverter"
2727
CONNECT_LOG4J_LOGGERS: org.apache.zookeeper=ERROR,org.I0Itec.zkclient=ERROR,org.reflections=ERROR
28-
28+
volumes:
29+
- ./kafka-connect-scripts/:/scripts/
30+
user: root # Switch to root to install packages
31+
command:
32+
- bash
33+
- /scripts/setup.sh
2934
networks:
3035
benchi:
3136
external: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "kafka-connect-mongo",
3+
"config":
4+
{
5+
"connector.class": "com.mongodb.kafka.connect.MongoSourceConnector",
6+
"connection.uri": "mongodb://mongo1:30001,mongo2:30002,mongo3:30003/test?replicaSet=my-replica-set",
7+
"database": "test",
8+
"collection": "users",
9+
10+
"change.stream.full.document": "updateLookup",
11+
12+
"output.schema.infer.value": "false",
13+
"output.format.value": "json",
14+
"output.format.key": "json",
15+
16+
"key.converter": "org.apache.kafka.connect.json.JsonConverter",
17+
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
18+
19+
"topic.prefix": "kafkaconnect",
20+
"poll.await.time.ms": 5000,
21+
"poll.max.batch.size": 1000,
22+
"batch.size": 130400000
23+
}
24+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4+
5+
curl -X POST -H "Content-Type: application/json" -d @"$SCRIPT_DIR/connector.json" localhost:8083/connectors
6+
7+
"$SCRIPT_DIR/stop_pipeline.sh"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# Install required packages
4+
yum install -y jq curl wget
5+
6+
# Install MongoDB connector
7+
confluent-hub install --no-prompt mongodb/kafka-connect-mongodb:latest
8+
9+
# Run the original entrypoint script as the confluent user
10+
su -c "/etc/confluent/docker/run" appuser
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4+
5+
curl -s -X PUT http://localhost:8083/connectors/$(jq -r '.name' "$SCRIPT_DIR/connector.json")/resume

0 commit comments

Comments
 (0)