Flume Integrated Kafka

Source: Internet
Author: User

First, the demand

    • Use flume to capture the file information under Linux and pass it into the Kafka cluster.
    • Environment ready Zookeeper cluster and Kafka cluster are installed well.

Second, the configuration flume

    • Download Flume website. The blogger himself is using flume1.6.0.
    • Official Address http://flume.apache.org/download.html
    • Unzip. TAR-ZXVF apache-flume-1.6.0-bin.tar.gz-c/usr/apps/
    • Create a flume configuration file.
    • Cd/usr/apps/flume/apache-flume-1.6.0-bin/conf
    • Vim exec.conf flume configuration file as follows
1A1.sources = R12A1.channels = C13A1.sinks = K14A1.sources.r1.type = Exec5A1.sources.r1.command = Tail-f/usr/test/click_log/1.log6A1.sources.r1.channels = C17A1.channels.c1.type=memory8a1.channels.c1.capacity=100009a1.channels.c1.transactioncapacity=100Ten#固定的不需要修改 OneA1.sinks.k1.type = Org.apache.flume.sink.kafka.KafkaSink A#消息的主题 -A1.sinks.k1.topic = Logmq -#kafka Broker Cluster theA1.sinks.k1.brokerList = bhz136:9092,bhz137:9092,bhz139:9092 -A1.sinks.k1.requiredAcks = 1 -A1.sinks.k1.batchSize = 20 -A1.sinks.k1.channel = C1

Third, start flume connected to Kafka

    • ./bin/flume-ng agent-n a1-c conf-f conf/exec.conf-dflume.root.logger=info,console

Iv. Start Kafka consumer consumption data

    • kafka-console-consumer.sh--zookeeper bhz136:2181--from-beginning--topic logmq

V. Run the test procedure. The test results are as follows:

Note: The 1.log file is a test file generated by the following script

  1for ((i=0;i<=50000;i++));   2          do echo "message-" + $i >>/usr/test/click_log/1.log;   3 Done


Flume Integrated Kafka

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.