Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sauljabin committed Jul 11, 2024
1 parent 319495d commit 00a12bf
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
CONFLUENT_VERSION=7.6.1
CLUSTER_ID=bgwoWzvSSlKmk2ysynPDNg
CLUSTER_ID=bgwoWzvSSlKmk2ysynPDNg
DB_PASSWORD=notasecret
DB_NAME=sandbox
14 changes: 9 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ services:
environment:
CONNECT_BOOTSTRAP_SERVERS: kafka1:9092,kafka2:9092,kafka3:9092
CONNECT_REST_ADVERTISED_HOST_NAME: localhost
CONNECT_REST_PORT: 8083
CONNECT_GROUP_ID: kafka-connect-sandbox
CONNECT_PLUGIN_PATH: /usr/local/share/kafka/plugins
CONNECT_KEY_CONVERTER: io.confluent.connect.avro.AvroConverter
Expand Down Expand Up @@ -112,8 +113,8 @@ services:
profiles:
- sql
environment:
MYSQL_DATABASE: sandbox
MYSQL_ROOT_PASSWORD: notasecret
MYSQL_DATABASE: ${DB_NAME}
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD}
ports:
- "3306:3306"
restart: on-failure
Expand All @@ -125,8 +126,8 @@ services:
profiles:
- sql
environment:
POSTGRES_DB: sandbox
POSTGRES_PASSWORD: notasecret
POSTGRES_DB: ${DB_NAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
- "5432:5432"
restart: on-failure
Expand Down Expand Up @@ -200,10 +201,12 @@ services:
args:
CONFLUENT_VERSION: ${CONFLUENT_VERSION}
environment:
PGPASSWORD: notasecret
PGPASSWORD: ${DB_PASSWORD}
MYSQL_PWD: ${DB_PASSWORD}
CLUSTER_ID: ${CLUSTER_ID}
volumes:
- .:/kafka-sandbox
- gradle_cache:/root/.gradle
entrypoint: /bin/bash
tty: true

Expand All @@ -214,3 +217,4 @@ volumes:
mysql_data:
postgres_data:
mosquitto_data:
gradle_cache:
2 changes: 1 addition & 1 deletion kafka-avro-clients/src/main/resources/producer.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ bootstrap.servers=kafka1:9092
schema.registry.url=http://schema-registry:8081
key.serializer=org.apache.kafka.common.serialization.StringSerializer
value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
acks=1
acks=all
client.id=client.producer
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ bootstrap.servers=kafka1:9092
schema.registry.url=http://schema-registry:8081
key.serializer=org.apache.kafka.common.serialization.StringSerializer
value.serializer=io.confluent.kafka.serializers.KafkaAvroSerializer
acks=1
acks=all
client.id=client.producer
2 changes: 1 addition & 1 deletion kafka-json-clients/src/main/resources/producer.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bootstrap.servers=kafka1:9092
key.serializer=org.apache.kafka.common.serialization.StringSerializer
acks=1
acks=all
client.id=client.producer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bootstrap.servers=kafka1:9092
key.serializer=org.apache.kafka.common.serialization.StringSerializer
acks=1
acks=all
client.id=client.producer
14 changes: 3 additions & 11 deletions md/kafka-connect-database-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@ docker compose exec cli bash
Populate it:

```bash
mysql --host=mysql --port=3306 \
--user=root --password=notasecret \
--database=sandbox \
< kafka-connect/sql/customers.sql
mysql --host=mysql --database=sandbox < kafka-connect/sql/customers.sql
```

That command should have created the table `customers` and inserted 200 records.

Now you can open [Adminer](http://localhost:9090) or run:

```bash
mysql --host=mysql --port=3306 \
--user=root --password=notasecret \
--database=sandbox \
-e "select * from customers"
mysql --host=mysql --database=sandbox -e "select * from customers"
```

### Create Source Connector
Expand Down Expand Up @@ -85,9 +79,7 @@ This sink connector is going to create a table `customers` on postgres and inser
Now you can open [Adminer](http://localhost:9090) or run:

```bash
psql --host=postgres --port=5432 \
--user=postgres --dbname=sandbox\
-c "select * from customers"
psql --host=postgres --user=postgres --dbname=sandbox -c "select * from customers"
```

List connector:
Expand Down

0 comments on commit 00a12bf

Please sign in to comment.