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
This script assumes that all components (Kafka, Connect, MQTT Broker) use default values.
6
7
7
-
=TODO UPDATE THIS DOCUMENT
8
+
== Configuration
8
9
9
-
== Deployment of UDF
10
+
Configure MQTT Connector
10
11
11
12
[source,bash]
12
13
----
13
-
mvn clean package
14
+
TODO
14
15
----
15
16
16
-
Copy `ksql-udf-deep-learning-mqtt-iot-1.0-jar-with-dependencies.jar` from the `target` folder to the `ext` folder of your KSQL installation (you will need to create the `ext` folder).
17
-
18
-
So if your Confluent Platform installation is at `/Users/kai.waehner/confluent-5.0.0` then copy the JAR to `/Users/kai.waehner/confluent-5.0.0/etc/ksql/ext`
19
-
20
-
Set `ksql.extension.dir` in `etc/ksql/ksql-server.properties`:
_Make sure to have Confluent folder on PATH. Otherwise, go to `$CONFLUENT_INSTALL/bin` to execute commands these commands._
30
20
31
-
Start the KSQL server and dependencies (Kafka, Zookeeper, Schema Registry):
21
+
Start Kafka Connect and dependencies (Kafka, Zookeeper, Schema Registry):
32
22
33
23
[source,bash]
34
24
----
35
-
confluent start ksql-server
25
+
confluent start kafka-connect
36
26
----
37
27
38
28
Create a topic for sensor reading:
@@ -42,80 +32,25 @@ Create a topic for sensor reading:
42
32
kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic temperature
43
33
----
44
34
45
-
Now configure the MQTT proxy, by creating a file called `kafka-mqtt-quickstart.properties`:
46
-
47
-
[source,bash]
48
-
----
49
-
topic.regex.list=temperature:.*temperature
50
-
listeners=0.0.0.0:1883
51
-
bootstrap.servers=PLAINTEXT://localhost:9092
52
-
confluent.topic.replication.factor=1
53
-
----
54
-
55
-
Launch the MQTT proxy:
56
-
57
-
[source,bash]
58
-
----
59
-
kafka-mqtt-start kafka-mqtt-quickstart.properties
60
-
----
61
-
62
-
63
-
You don't need to start the MQTT Broker (in this example the Mosquitto server)! You just use Mosquitto later to produce MQTT messages via `mosquitto_pub` command. If you (want to) start the Mosquitto server, you might get a port issue with MQTT Proxy, in that case change the default port of Mosquitto server.
64
-
65
-
To run `mosquitto_pub` on the Mac, install it first with Homebrew: `brew install mosquitto`. You'll need this if you want to use the `sensor_generator.sh` script later on.
66
-
67
-
== KSQL and Predictions
68
-
69
-
Start KSQL CLI:
35
+
Start the MQTT Broker:
70
36
71
37
[source,bash]
72
38
----
73
-
ksql http://localhost:8088
74
-
----
75
-
76
-
Confirm that the UDF has been successfully registered (check the KSQL server log if not):
77
-
78
-
[source,sql]
79
-
----
80
-
ksql> LIST FUNCTIONS;
81
-
82
-
Function Name | Type
83
-
-------------------------------------
84
-
ABS | SCALAR
85
-
ANOMALY | SCALAR
86
-
[...]
87
-
----
88
-
89
-
Register the sensor topic's schema with KSQL:
90
-
91
-
[source,sql]
92
-
----
93
-
CREATE STREAM carsensor (eventid integer, sensorinput varchar) WITH (kafka_topic='temperature', value_format='DELIMITED');
39
+
todo
94
40
----
95
41
96
-
Set a continuous query running in KSQL:
97
-
98
-
[source,sql]
99
-
----
100
-
SELECT EVENTID, ANOMALY(SENSORINPUT) FROM CARSENSOR;
101
-
----
102
-
103
-
Send a sample message to the Kafka topic, from a separate shell prompt (i.e. not KSQL):
0 commit comments