使用Flume客户端 client.sources staticlogsource client.channels staticlogchannel client.sinks kafkasink LOGTOHDFSONLINE1 client.sources.staticlogsource.type spooldir client.sources.staticlogsource.spoolDir 监控目录 client.sources.staticlogsource.fileSuffix .COMPLETED client.sources.staticlogsource.ignorePattern ^$ client.sources.staticlogsource.trackerDir 传输过程中元数据存储路径 client.sources.staticlogsource.maxBlobLength 16384 client.sources.staticlogsource.batchSize 51200 client.sources.staticlogsource.inputCharset UTF8 client.sources.staticlogsource.deserializer LINE client.sources.staticlogsource.selector.type replicating client.sources.staticlogsource.fileHeaderKey file client.sources.staticlogsource.fileHeader false client.sources.staticlogsource.basenameHeader true client.sources.staticlogsource.basenameHeaderKey basename client.sources.staticlogsource.deletePolicy never client.channels.staticlogchannel.type file client.channels.staticlogchannel.dataDirs 数据缓存路径,设置多个路径可提升性能,中间用逗号分开 client.channels.staticlogchannel.checkpointDir 检查点存放路径 client.channels.staticlogchannel.maxFileSize 2146435071 client.channels.staticlogchannel.capacity 1000000 client.channels.staticlogchannel.transactionCapacity 612000 client.channels.staticlogchannel.minimumRequiredSpace 524288000 client.sinks.kafkasink.type org.apache.flume.sink.kafka.KafkaSink client.sinks.kafkasink.kafka.topic 数据写入的topic ,如flumetest client.sinks.kafkasink.kafka.bootstrap.servers XXX . XXX . XXX . XXX :kafka 端口号 , XXX . XXX . XXX . XXX :kafka 端口号 , XXX . XXX . XXX . XXX :kafka端口号 client.sinks.kafkasink.flumeBatchSize 1000 client.sinks.kafkasink.kafka.producer.type sync client.sinks.kafkasink.kafka.security.protocol SASLPLAINTEXT client.sinks.kafkasink.kafka.kerberos.domain.name Kafka Domain名称,安全集群必填,如hadoop.xxx.1com client.sinks.kafkasink.requiredAcks 0 client.sources.staticlogsource.channels staticlogchannel client.sinks.kafkasink.channel staticlogchannel 说明 client.sinks.kafkasink.kafka.topic:数据写入的topic。若kafka中该topic不存在,默认情况下会自动创建该topic。 client.sinks.kafkasink.kafka.bootstrap.servers:Kafkabrokers列表,多个用英文逗号分隔。默认情况下,安全集群端口21007,普通集群对应端口9092。 client.sinks.kafkasink.kafka.security.protocol:安全集群为SASLPLAINTEXT,普通集群为PLAINTEXT。 client.sinks.kafkasink.kafka.kerberos.domain.name: 普通集群无需配置此参数。安全集群对应此参数的值为Kafka集群中“kerberos.domain.name”对应的值。 具体可到Broker实例所在节点上查看${BIGDATAHOME}/MRSCurrent/1 X Broker/etc/server.properties。 其中X为随机生成的数字,请根据实际情况修改。同时文件需要以Flume客户端安装用户身份保存,例如root用户。 具体可到Broker实例所在节点上查看“${BIGDATAHOME}/FusionInsightCurrent/1XBroker/etc/server.properties”。 9. 参数配置并保存后,Flume客户端将自动加载“properties.properties”中配置的内容。当spoolDir生成新的日志文件,文件内容将发送到Kafka生产者,并支持Kafka消费者消费。