Code Monkey home page Code Monkey logo

demo-kafka-sparkstream-hbase's Introduction

demo-kafka-sparkstream-hbase

Demo for loading data from Kafka into HBase table through SparkStreaming. Calculates MIN, MAX, AVG (SUM, CNT) on Minute bases.

Kafka topic: demo-stream-topic
HBase table: demo-log
HBase family: demo-ts-metrics

Input data example (paste exactly into Kafka Producer console):
2015-03-01 01:17:12.874,4
2015-03-01 01:17:01.874,6
2015-03-01 01:18:21.874,5
2015-03-01 01:18:12.101,3
2015-03-01 01:18:55.860,2

Please, delete appropriate checkpointed data from Driver before execution, i.e.

rm -rf /tmp/checkpoint*
rm -rf /tmp/spark-*

Kafka

Be sure your ZooKeeper instance is up and running, else start system zoo or embedded one from Kafka.

bin/zookeeper-server-start.sh config/zookeeper.properties  

Start Kafka server:

bin/kafka-server-start.sh config/server.properties

Create topic for test purposes:

bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic demo-stream-topic

You could find all topics running following command:

bin/kafka-topics.sh --list --zookeeper localhost:2181

We would use embedded console producer/consumer for fetching and debugging messages to know what is going on for simplifying. For more advance profiling there's more convenient to use customized JMeter generator to produce Kafka messages.

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic demo-stream-topic  
bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic demo-stream-topic --from-beginning  

HBase

Table created through Cloudera Hue gui (HBase Browser). RowKey is a TimeStamp value trimmed to Minutes from Stream.

Simplifications

  • We don't use info already loaded into HBase table
  • We don't apply changes provided by external applications on HBase table

It's possible to use one more DStream for reading from HBase and union KafkaStream with HBaseStream to fetch external HBase table modifications.

demo-kafka-sparkstream-hbase's People

Contributors

eugeneyushin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.