SparkStreaming-Kafka-example
mvn archetype:generate -B
-DarchetypeGroupId=net.alchim31.maven -DarchetypeArtifactId=scala-archetype-simple -DarchetypeVersion=1.5
-DgroupId=com.hpds -DartifactId=SparkStreaming-Kafka-example -Dversion=0.1-SNAPSHOT -Dpackage=com.hpds
mvn clean package
bin/zkServer.sh start
JMX_PORT=999x bin/kafka-server-start.sh config/server.properties
sbin/start-all.sh
create topic : bin/kafka-topics.sh --create \
--replication-factor 3 \
--partition 3 \
--topic test_topic \
--zookeeper ip1:2181,ip2:2181,ip3:2181 ...
java -cp SparkStreaming-Kafka-example-0.1-SNAPSHOT-jar-with-dependencies.jar com.hpds.ScalaProducerExample 10000 test_topic localhost:9092 (the port is depend on your kafka server.properties)
./spark-submit --class com.hpds.ScalaConsumerExample --master spark://master:7077 SparkStreaming-Kafka-example-0.1-SNAPSHOT-jar-with-dependencies.jar localhost:2181 test_topic test_topic 1
scala-archetype-simple
kafka-example-in-scala
official example-SparkStreaming kafkaWordCount