READY FILE
wget http://apache.mirror.cdnetworks.com/kafka/1.1.0/kafka_2.11-1.1.0.tgz wget http://apache.mirror.cdnetworks.com/zookeeper/zookeeper-3.4.11/zookeeper-3.4.11.tar.gz
KAFKA INSTALL(JAVA VERSION) - https://kafka.apache.org/quicksta 1. Download the 1.1.0 release and un-tar it. > tar -xzf kafka_2.11-1.1.0.tgz > cd kafka_2.11-1.1.0
2. Start the server 2.1 Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you don't already have one. You can use the convenience script packaged with kafka to get a quick-and-dirty single-node ZooKeeper instance.
> bin/zookeeper-server-start.sh config/zookeeper.properties
3. Step 3: Create a topic 3.1 Let's create a topic named "test" with a single partition and only one replica:
> bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic test > bin/kafka-server-start.sh config/server.properties > for ii in `seq 20180411 20180431`; do bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic $ii; done > cd /home1/irteamsu/kafka2/kafka_2.11-1.1.0 > bin/kafka-server-start.sh config/server.properties > bin/kafka-topics.sh --list --zookeeper localhost:2181
4. Send some messages 4.1 Kafka comes with a command line client that will take input from a file or from standard input and send it out as messages to the Kafka cluster. By default, each line will be sent as a separate message.
Run the producer and then type a few messages into the console to send to the server.
> bin/kafka-console-producer.sh --broker-list localhost:9092 --topic test 5. Start a consumer 5.1 Kafka also has a command line consumer that will dump out messages to standard output.
> bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning > bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic 20180412 --from-beginning
[irteamsu@cdb021.imgr kafka_2.11-1.1.0]$ netstat -an | grep 2181 tcp 0 0 0.0.0.0:2181 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:49964 127.0.0.1:2181 TIME_WAIT tcp 0 0 127.0.0.1:35802 127.0.0.1:2181 ESTABLISHED tcp 0 0 127.0.0.1:2181 127.0.0.1:35802 ESTABLISHED [irteamsu@cdb021.imgr kafka_2.11-1.1.0]$ netstat -an | grep 9092 tcp 0 0 0.0.0.0:9092 0.0.0.0:* LISTEN tcp 0 0 10.113.68.29:9092 10.113.68.28:50494 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50516 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50502 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50504 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50480 ESTABLISHED tcp 0 0 127.0.0.1:43490 127.0.0.1:9092 ESTABLISHED tcp 0 0 127.0.0.1:9092 127.0.0.1:43490 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50520 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50490 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50481 ESTABLISHED tcp 0 72 10.113.68.29:53448 10.113.68.29:9092 ESTABLISHED tcp 0 0 10.113.68.29:9092 10.113.68.28:50508 ESTABLISHED [irteamsu@cdb021.imgr kafka_2.11-1.1.0]$
/*------------------------------------------------------------ * The Apache Kafka C/C++ library *-----------------------------------------------------------/
[irteamsu@cdb021.imgr librdkafka]$ history 1 2018-04-04_17:44:32\ ls 2 2018-04-04_17:44:40\ cd 3 2018-04-04_17:44:40\ ls 4 2018-04-04_17:44:45\ cd install 5 2018-04-04_17:44:49\ mkdir install 6 2018-04-04_17:44:51\ cd install/ 7 2018-04-04_17:44:51\ ls 8 2018-04-04_17:45:04\ mkdir kafka 9 2018-04-04_17:45:05\ cd kafka/ 10 2018-04-04_17:45:06\ ls 11 2018-04-04_17:45:10\ git clone https://github.com/edenhill/librdkafka 12 2018-04-04_17:45:14\ ls 13 2018-04-04_17:45:16\ cd librdkafka/ 14 2018-04-04_17:45:16\ ls 15 2018-04-04_17:45:23\ ./configure 16 2018-04-04_17:45:26\ make 17 2018-04-04_17:46:08\ vi README. 18 2018-04-04_17:46:13\ vi README.md 19 2018-04-04_17:46:26\ sudo make install 20 2018-04-04_17:49:19\ pwd 21 2018-04-04_17:49:21\ history [irteamsu@cdb021.imgr librdkafka]$ pwd /home1/irteamsu/install/kafka/librdkafka
#include:/usr/local/include/librdkafka/ #lib:/usr/local/lib
ReadQueueApacheData: error while loading shared libraries: librdkafka.so.1: cannot open shared object file: No such file or directory ReadQueueApacheData: error while loading shared libraries: librdkafka.so.1: cannot open shared object file: No such file or directory ReadQueueApacheData: error while loading shared libraries: librdkafka.so.1: cannot open shared object file: No such file or directory
#프로파일에 저장 export LD_LIBRARY_PATH=/usr/local/lib
https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_simple_producer.c https://github.com/edenhill/librdkafka/blob/master/examples/rdkafka_consumer_example.c
|