Giter Club home page Giter Club logo

kafka-storm-hive-bolt's Introduction

kafka-storm-hive-bolt

prerequisites

// create hive table
CREATE TABLE sample_07_orc(
  code  string,
    description string,
      total_emp string,
        salary string
        )
PARTITIONED BY (location STRING)
CLUSTERED BY (code) into 5 buckets
STORED AS ORC
TBLPROPERTIES ("orc.compress"="SNAPPY","transactional"="true");

//sample data for table
1,discription,1000,100000,IND

// create kafka input and output topic
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --create --zookeeper `hostname`:2181 --replication-factor 1 --partition 1 --topic sampleinput
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --create --zookeeper `hostname`:2181 --replication-factor 1 --partition 1 --topic samplepleoutput

//topology.properties
zkhost = sandbox.hortonworks.com:2181
inputTopic =sampleinput
outputTopic=sampleoutput
KafkaBroker =sandbox.hortonworks.com:6667
consumerGroup=id7
metaStoreURI = thrift://sandbox.hortonworks.com:9083
dbName = default
tblName = sample_07_orc

checkout git

git clone https://github.com/rajkrrsingh/kafka-storm-hive-bolt.git

build using maven

mvn clean package

run on storm cluster

storm jar /tmp/kafka-storm-*.jar com.storm.topology.KafkaTopology  /tmp/topology.properties stormtopo

to test it working produce some messages using kafka console producer

/usr/hdp/current/kafka-broker/bin/kafka-console-producer.sh --broker-list `hostname`:6667 --topic sampleinput
1,discription,1000,100000,IND
1,discription,1000,100000,IND
1,discription,1000,100000,IND

check the output in hive table

hive> select * from sample_07_orc;
OK
1   discription 1000    100000  IND
Time taken: 0.512 seconds, Fetched: 1 row(s)

message from kafkaSpout will be written to kafka output topic(sampleoutput)

/usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --zookeeper `hostname`:2181 --topic sampleoutput --from-beginning
{metadata.broker.list=sandbox.hortonworks.com:6667, request.timeout.ms=30000, client.id=console-consumer-80470, security.protocol=PLAINTEXT}
1,discription,1000,100000,IND
1,discription,1000,100000,IND
1,discription,1000,100000,IND

kafka-storm-hive-bolt's People

Contributors

rajkrrsingh 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.