Last active
May 16, 2019 23:45
-
-
Save PeterCorless/63eda7f6bb37846dce79f2cce8dc530f to your computer and use it in GitHub Desktop.
Scylla + Confluent IoT Examples - Updated 16 May 2019
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tar -xzf confluent-5.2.0-2.12.tar.gz | |
$ cd confluent-5.2.0/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export PATH="$PATH:/YOUR_LOCAL_PATH_TO_BINARIES/confluent-5.2.0/bin" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew tap confluentinc/homebrew-confluent-hub-client | |
$ brew cask install confluent-hub-client | |
$ confluent-hub install confluentinc/kafka-connect-cassandra:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ confluent start connect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ zookeeper-server-start ./etc/kafka/zookeeper.properties | |
$ kafka-server-start ./etc/kafka/server.properties | |
$ bin/schema-registry-start ./etc/schema-registry/schema-registry.properties | |
$ connect-distributed ./etc/schema-registry/connect-avro-distributed.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic temperature | |
$ kafka-topics --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic brightness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kafka-mqtt-start kafka-mqtt-dev.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ brew install mosquitto | |
$ brew link mosquitto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ mosquitto_pub -h 0.0.0.0 -p 1883 -t car/engine/temperature -q 2 -m "190F" | |
$ mosquitto_pub -h 0.0.0.0 -p 1883 -t car/engine/temperature -q 2 -m "200F" | |
$ mosquitto_pub -h 0.0.0.0 -p 1883 -t car/engine/temperature -q 2 -m "210F" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kafka-console-consumer --bootstrap-server localhost:9092 \ | |
--topic temperature \ | |
--property print.key=true \ | |
--from-beginning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do echo $(( $RANDOM % (231-180) + 180)); sleep .2; done | \ | |
mosquitto_pub -h 0.0.0.0 -p 1883 -t car/engine/temperature -q 2 -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git clone https://github.com/scylladb/scylla-code-samples/ | |
$ cd gce_deploy_and_install_scylla_cluster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$./gce_deploy_and_install_scylla_cluster.sh -t n1-standard-16 -n -c5 -v3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ confluent start ksql-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ksql> SHOW TOPICS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ksql> CREATE STREAM sensorreadings (eventid integer, sensorinput varchar) WITH (kafka_topic='temperature', value_format='AVRO'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ confluent-hub install confluentinc/kafka-connect-cassandra:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name=sink | |
topics=temperature | |
tasks.max=1 | |
connector.class=io.confluent.connect.cassandra.CassandraSinkConnector | |
cassandra.contact.points=<PUBLIC IPs of your SCYLLA Cluster (IP1,IP2,IP3)> | |
cassandra.keyspace=demo | |
cassandra.compression=SNAPPY | |
cassandra.consistency.level=LOCAL_QUORUM | |
transforms=prune | |
transforms.prune.type=org.apache.kafka.connect.transforms.ReplaceField$Value | |
transforms.prune.whitelist=CreatedAt,Id,Text,Source,Truncated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ connect-standalone <FULL_PATH>/confluent-5.2.0/etc/schema-registry/connect-avro-standalone.properties <FULL_PATH>/confluent-5.2.0/share/confluent-hub-components/confluentinc-kafka-connect-cassandra/etc/sink.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$./sensor_generator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment