Skip to content

Commit

Permalink
Mods for KSQL demo ; slight tweak to README
Browse files Browse the repository at this point in the history
  • Loading branch information
ybyzek committed Jun 13, 2018
1 parent e532a1a commit b620fbd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,19 @@ This step is optional: to verify that Kafka is working as expected, connect to o
$ kubectl get pods
```

2. Choose a running Kafka pod and connect to it. You may need to wait for the Kafka cluster to finish starting up.
2. View the containers in a pod.

```sh
$ kubectl describe pod/my-confluent-oss-cp-kafka-0
...
Containers:
prometheus-jmx-exporter:
...
cp-kafka-broker:
...
```

3. Connect to the container `cp-kafka-broker` in the pod. You may need to wait for the Kafka cluster to finish starting up.

```sh
$ kubectl exec -c cp-kafka-broker -it my-confluent-oss-cp-kafka-0 -- /bin/bash /usr/bin/kafka-console-producer --broker-list localhost:9092 --topic test
Expand All @@ -199,13 +211,13 @@ $ kubectl exec -c cp-kafka-broker -it my-confluent-oss-cp-kafka-0 -- /bin/bash /
Wait for a `>` prompt, and enter some text.

```
msg123
msg456
m1
m2
```

Press Control-d to close the producer session.

Next, consume the messages from the same Kafka topic. Substitute `my-confluent-oss` with whatever you named your release.
4. Consume the messages from the same Kafka topic. Substitute `my-confluent-oss` with whatever you named your release.

```sh
$ kubectl exec -c cp-kafka-broker -it my-confluent-oss-cp-kafka-0 -- /bin/bash /usr/bin/kafka-console-consumer --bootstrap-server localhost:9092 --topic test --from-beginning
Expand Down
24 changes: 15 additions & 9 deletions examples/ksql-demo.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
###
# Example pod with containers for playing with KSQL on Kubernetes. Not for production.
# To run queries:
# Example pod with containers for using KSQL on Kubernetes. Not for production.
#
# kubectl exec -it ksql-demo --container ksql-server -- /bin/bash
# root@ksql-demo:/# ksql
# Before you run:
# - Note the bootstrap servers are `my-confluent-oss-cp-kafka:9092`. You may need to change this with your own connection strings
#
# Try any query from: https://docs.confluent.io/current/ksql/docs/tutorials/basics-docker.html#create-a-stream-and-table
# Run the pod:
# $ kubectl apply -f examples/ksql-demo.yaml
#
# Run KSQL CLI:
# $ kubectl exec -it ksql-demo --container ksql -- /bin/bash ksql
# ksql> list topics ;
# ksql> print 'pageviews';
#
# Then create any query: https://docs.confluent.io/current/ksql/docs/tutorials/basics-docker.html#create-a-stream-and-table
#
# Note the hardcoded bootstrap servers. You'll need to replace them with your own connection strings
###
apiVersion: v1
kind: Pod
Expand All @@ -21,18 +27,18 @@ spec:
command:
- sh
- -c
- "exec java -jar /usr/share/java/ksql-examples/ksql-examples-5.0.0-SNAPSHOT-standalone.jar quickstart=pageviews format=delimited topic=pageviews bootstrap-server=oldfashioned-dog-cp-kafka:9092"
- "exec java -jar /usr/share/java/ksql-examples/ksql-examples-5.0.0-SNAPSHOT-standalone.jar quickstart=pageviews format=delimited topic=pageviews bootstrap-server=my-confluent-oss-cp-kafka:9092"
- name: ksql-datagen-users
image: confluentinc/ksql-examples:5.0.0-beta1
command:
- sh
- -c
- "exec java -jar /usr/share/java/ksql-examples/ksql-examples-5.0.0-SNAPSHOT-standalone.jar quickstart=users format=json topic=users iterations=1000 bootstrap-server=oldfashioned-dog-cp-kafka:9092"
- "exec java -jar /usr/share/java/ksql-examples/ksql-examples-5.0.0-SNAPSHOT-standalone.jar quickstart=users format=json topic=users iterations=1000 bootstrap-server=my-confluent-oss-cp-kafka:9092"
- name: ksql
image: confluentinc/ksql-cli:5.0.0-beta1
env:
- name: KSQL_OPTS
value: "-Dbootstrap.servers=oldfashioned-dog-cp-kafka:9092"
value: "-Dbootstrap.servers=my-confluent-oss-cp-kafka:9092"
command:
- sh
- -c
Expand Down

0 comments on commit b620fbd

Please sign in to comment.