Skip to content

iamjustadd/rdKafkaDemo

Repository files navigation

rdKafkaDemo

This project is a demo that uses librdkafka to simulate the data generated by online grabbing the target socket.

To use this demo, you should first install librdkafka,by such command:

apt-get install -y g++ cmake make

git clone https://github.com/edenhill/librdkafka.git

cd librdkafka/

./configure

make&& make install

you should then configure your zookeeper and kafka. You can refer to this article

https://www.cnblogs.com/zhaoshizi/p/12154518.html

it will show you how to install and configure zookeeper and kafka, then you should run such command to start service of kafka and zookeeper.

zookeeper-server-start.sh /root/kafka/kafka_2.12-2.8.0/config/zookeeper.properties

kafka-server-start.sh /root/kafka/kafka_2.12-2.8.0/config/server.properties

you'd better run previous two commands in two terminals.

then compile processor.cpp and demoMultiProcedur.cpp and demoConsumer.cpp by using command:

g++ demoMultiProducer.cpp socketServer.cpp -o multiPord -g -std=c++11 -I/usr/local/include/librdkafka -L/usr/local/lib -lrdkafka -lrdkafka++

g++ demoConsumer.cpp -o demoConsumer -g -std=c++11 -I/usr/local/include/librdkafka -L/usr/local/lib -lrdkafka -lrdkafka++

g++ processor.cpp -o processor -g -std=c++11

then , after starting kafka and zookeeper, try run ./demoConsumer first,

then start ./multiPord to listen giving port

then try run ./processor to generate random data.

that's all. rerorerorerorerorero

About

A demo that uses librdkafka to simulate the data generated by online grabbing the target socket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages