Flume Study---Kafka source__flume

Source: Internet
Author: User
Tags serialization
Kafka Source

Kafka source is an Apache Kafka consumer who reads messages from a Kafka topic. If you have multiple Kafka source runs, you can configure them using the same consumer group, so each will read a unique set of partitions in topic.
The main properties of the Type:source type must be used Org.apache.flume.source.kafka.KafkaSource kafka.bootstrap.servers:List of brokers in the Kafka cluster used by the source kafka.consumer.group.id: Unique identification of the consumer group. Setting the same IDs in multiple sources or agents means that they are part of the same consumer group Kafka.topics: Kafka Consumers who use all the good things separated from those topics get messages Kafka.topics.regex: Using regular expressions is a collection of topic that defines the source subscription, which has a higher precedence than kafka.topics and overrides Kafka.topics (if present). BatchSize: The maximum number of messages written to the channel in a batch- Note:


Kafka Source covers two Kafka user parameters:
Auto.commit.enable is set to "false" by the source, and each batch is committed. The Kafka source guarantees a message retrieval policy at least once. Duplicates can exist when the source is started.
Kafka Source also provides Key.deserializer (Org.apache.kafka.common.serialization.StringSerializer) and Value.deserializer ( Default value for Org.apache.kafka.common.serialization.ByteArraySerializer). Modifying these parameters is not recommended.
# # #启用的属性
Examples of topic lists with a well split subscription

Tier1.sources.source1.type = Org.apache.flume.source.kafka.KafkaSource
tier1.sources.source1.channels = Channel1
tier1.sources.source1.batchSize = 5000
Tier1.sources.source1.batchDurationMillis =
Tier1.sources.source1.kafka.bootstrap.servers = localhost:9092
tier1.sources.source1.kafka.topics = test1, Test2
tier1.sources.source1.kafka.consumer.group.id = custom.g.id
subscription topic with regular expression matching
Tier1.sources.source1.type = Org.apache.flume.source.kafka.KafkaSource
tier1.sources.source1.channels = Channel1
tier1.sources.source1.kafka.bootstrap.servers = localhost:9092
Tier1.sources.source1.kafka.topics.regex = ^topic[0-9]$
# The default kafka.consumer.group.id=flume is used
not to be continued ...

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.