ARTIK MQTT + Raspberry Pi Apache Kafka Cluster Bridge [P014]



* Arduino MQTT Client to ARTIK MQTT Broker


* ARTIK MQTT Broker & Raspberry Pi Kafka Cluster


* Run MQTT-Kafka-Bridge


* Kafka Console Consumer


* KafkaMonitor



https://www.youtube.com/watch?v=JIEIv-pEFFs


*GitHub : https://github.com/rdiot/rdiot-p014.git


* Parts

- Arduino UNO

Ethernet W5100 Shield (W5100) [B004]

LCD1602 I2C (LCD1602) [D016]

Photo Resistor Module (KY-018) [S002]

Temperature and humidity DHT22 (DHT22) [S063]

TPM-300 Air Quality Module (TPM-300) [S092]

Samsung ARTIK 5 (ARTIK5-V0.5) [B023]

Raspberry Pi 3 B Model (RASPBERRY-PI-3-B) [B088] x 3ea

- USB Power Supply

- Ethernet Hub



* Contents

1.  ARTIK MQTT Start 

- mqtt broker (1883)

$ mosquitto &


2. Add MQTT Topics in the node-red

- node-red (1880)

$ node-red &


3. Arduino MQTT Client 

- source

https://github.com/rdiot/rdiot-p014/blob/master/arduino_mqtt_client.ino



4. MQTT Kakfa Bridge
- source

https://github.com/rdiot/rdiot-p014/blob/master/MqttToKafkaReConn.java

- maven 

    <!--  mqtt-client -->

<dependency>

    <groupId>org.fusesource.mqtt-client</groupId>

    <artifactId>mqtt-client</artifactId>

    <version>1.14</version>

</dependency>

<!-- kafka -->

<dependency>

<groupId>org.apache.kafka</groupId>

<artifactId>kafka_2.9.1</artifactId>

<version>0.8.2.1</version>

</dependency>


- run script

https://github.com/rdiot/rdiot-p014/blob/master/mqtt-kafka-bridge.sh

$ java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar 

$ nohup java -jar mqtt-kafka-bridge-0.0.1-SNAPSHOT.jar > output.txt &


5. Kafka Console Consumer 

- run script

https://github.com/rdiot/rdiot-p014/blob/master/consumer.sh

$ /data1/kafka/kafka/bin/kafka-console-consumer.sh --zookeeper kafka-pi-01:2181,kafka-pi-02:2181,kafka-pi-03:2181 --topic $1


- run command

$ ./consumer.sh temperature,humidity,cds,airGrade

$ ./consumer.sh temperature


Posted by RDIoT
|