Skip to content

Commit b242c35

Browse files
authored
Update Kafka tutorial to work with Apache Kafka (tensorflow#1266)
* Update Kafka tutorial to work with Apache Kafka Minor update to the Kafka tutorial to remove the dependency on Confluent's distribution of Kafka, and instead work with vanilla Apache Kafka. Signed-off-by: Dale Lane <[email protected]> * Address review comments Remove redundant pip install commands Signed-off-by: Dale Lane <[email protected]>
1 parent 97ab45f commit b242c35

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

docs/tutorials/kafka.ipynb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@
7070
"source": [
7171
"## Overview\n",
7272
"\n",
73-
"This tutorial focuses on streaming data from a [Kafka](https://docs.confluent.io/current/getting-started.html) cluster into a `tf.data.Dataset` which is then used in conjunction with `tf.keras` for training and inference.\n",
73+
"This tutorial focuses on streaming data from a [Kafka](https://kafka.apache.org/quickstart) cluster into a `tf.data.Dataset` which is then used in conjunction with `tf.keras` for training and inference.\n",
7474
"\n",
7575
"Kafka is primarily a distributed event-streaming platform which provides scalable and fault-tolerant streaming data across data pipelines. It is an essential technical component of a plethora of major enterprises where mission-critical data delivery is a primary requirement.\n",
7676
"\n",
77-
"**NOTE:** A basic understanding of the [kafka components](https://docs.confluent.io/current/kafka/introduction.html) will help you in following the tutorial with ease."
77+
"**NOTE:** A basic understanding of the [kafka components](https://kafka.apache.org/documentation/#intro_concepts_and_terms) will help you in following the tutorial with ease.",
78+
"\n",
79+
"**NOTE:** A Java runtime environment is required to run this tutorial."
7880
]
7981
},
8082
{
@@ -180,8 +182,8 @@
180182
},
181183
"outputs": [],
182184
"source": [
183-
"!curl -sSOL http://packages.confluent.io/archive/5.4/confluent-community-5.4.1-2.12.tar.gz\n",
184-
"!tar -xzf confluent-community-5.4.1-2.12.tar.gz"
185+
"!curl -sSOL https://downloads.apache.org/kafka/2.7.0/kafka_2.13-2.7.0.tgz\n",
186+
"!tar -xzf kafka_2.13-2.7.0.tgz"
185187
]
186188
},
187189
{
@@ -190,7 +192,7 @@
190192
"id": "vAzfu_WiEs4F"
191193
},
192194
"source": [
193-
"Using the default configurations (provided by the confluent package) for spinning up the instances."
195+
"Using the default configurations (provided by Apache Kafka) for spinning up the instances."
194196
]
195197
},
196198
{
@@ -201,8 +203,8 @@
201203
},
202204
"outputs": [],
203205
"source": [
204-
"!cd confluent-5.4.1 && bin/zookeeper-server-start -daemon etc/kafka/zookeeper.properties\n",
205-
"!cd confluent-5.4.1 && bin/kafka-server-start -daemon etc/kafka/server.properties\n",
206+
"!./kafka_2.13-2.7.0/bin/zookeeper-server-start.sh -daemon ./kafka_2.13-2.7.0/config/zookeeper.properties\n",
207+
"!./kafka_2.13-2.7.0/bin/kafka-server-start.sh -daemon ./kafka_2.13-2.7.0/config/server.properties\n",
206208
"!echo \"Waiting for 10 secs until kafka and zookeeper services are up and running\"\n",
207209
"!sleep 10\n"
208210
]
@@ -247,8 +249,8 @@
247249
},
248250
"outputs": [],
249251
"source": [
250-
"!confluent-5.4.1/bin/kafka-topics --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic susy-train\n",
251-
"!confluent-5.4.1/bin/kafka-topics --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 2 --topic susy-test\n"
252+
"!./kafka_2.13-2.7.0/bin/kafka-topics.sh --create --bootstrap-server 127.0.0.1:9092 --replication-factor 1 --partitions 1 --topic susy-train\n",
253+
"!./kafka_2.13-2.7.0/bin/kafka-topics.sh --create --bootstrap-server 127.0.0.1:9092 --replication-factor 1 --partitions 2 --topic susy-test\n"
252254
]
253255
},
254256
{
@@ -268,8 +270,8 @@
268270
},
269271
"outputs": [],
270272
"source": [
271-
"!confluent-5.4.1/bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --describe --topic susy-train\n",
272-
"!confluent-5.4.1/bin/kafka-topics --bootstrap-server 127.0.0.1:9092 --describe --topic susy-test\n"
273+
"!./kafka_2.13-2.7.0/bin/kafka-topics.sh --describe --bootstrap-server 127.0.0.1:9092 --topic susy-train\n",
274+
"!./kafka_2.13-2.7.0/bin/kafka-topics.sh --describe --bootstrap-server 127.0.0.1:9092 --topic susy-test\n"
273275
]
274276
},
275277
{
@@ -720,7 +722,7 @@
720722
},
721723
"outputs": [],
722724
"source": [
723-
"!confluent-5.4.1/bin/kafka-consumer-groups --bootstrap-server 127.0.0.1:9092 --describe --group testcg\n"
725+
"!./kafka_2.13-2.7.0/bin/kafka-consumer-groups.sh --bootstrap-server 127.0.0.1:9092 --describe --group testcg\n"
724726
]
725727
},
726728
{

0 commit comments

Comments
 (0)