hadoop - 为什么我的 Flume 代理没有启动?

标签 hadoop apache-kafka flume flume-ng

我正在尝试设置一个基本的 Kafka-Flume-HDFS 管道。 Kafka 已启动并正在运行,但是当我通过

启动水槽代理时
bin/flume-ng agent -n flume1 -c conf -f conf/flume-conf.properties -D flume.root.logger=INFO,console

似乎代理没有出现,因为我得到的唯一控制台日志是:

Info: Sourcing environment configuration script /opt/hadoop/flume/conf/flume-env.sh
Info: Including Hive libraries found via () for Hive access
+ exec /opt/jdk1.8.0_111/bin/java -Xmx20m -D -cp '/opt/hadoop/flume/conf:/opt/hadoop/flume/lib/*:/opt/hadoop/flume/lib/:/lib/*' -Djava.library.path= org.apache.flume.node.Application -n flume1 -f conf/flume-conf.properties flume.root.logger=INFO,console
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop/flume/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop/flume/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

水槽配置文件:

flume1.sources = kafka-source-1
flume1.channels = hdfs-channel-1
flume1.sinks = hdfs-sink-1
flume1.sources.kafka-source-1.type = org.apache.flume.source.kafka.KafkaSource
flume1.sources.kafka-source-1.zookeeperConnect = localhost:2181
flume1.sources.kafka-source-1.topic = twitter_topic
flume1.sources.kafka-source-1.batchSize = 100
flume1.sources.kafka-source-1.channels = hdfs-channel-1

flume1.channels.hdfs-channel-1.type = memory
flume1.sinks.hdfs-sink-1.channel = hdfs-channel-1
flume1.sinks.hdfs-sink-1.type = hdfs
flume1.sinks.hdfs-sink-1.hdfs.writeFormat = Text
flume1.sinks.hdfs-sink-1.hdfs.fileType = DataStream
flume1.sinks.hdfs-sink-1.hdfs.filePrefix = test-events
flume1.sinks.hdfs-sink-1.hdfs.useLocalTimeStamp = true
flume1.sinks.hdfs-sink-1.hdfs.path = /tmp/kafka/twitter_topic/%y-%m-%d
flume1.sinks.hdfs-sink-1.hdfs.rollCount= 100
flume1.sinks.hdfs-sink-1.hdfs.rollSize= 0
flume1.channels.hdfs-channel-1.capacity = 10000
flume1.channels.hdfs-channel-1.transactionCapacity = 1000

这是 flume-conf.properties 中的配置问题还是我遗漏了一些重要的东西?

编辑

在重新启动一切之后它似乎比以前工作得更好,Flume 现在实际上正在做一些事情(启动 hdfs、zookeeper、kafka、flume 和我的流应用程序时似乎顺序很重要)。 我现在从水槽中得到一个异常(exception)

java.lang.NoSuchMethodException: org.apache.hadoop.fs.LocalFileSystem.isFileClosed(org.apache.hadoop.fs.path)
...

最佳答案

使用完整的 HDFS URI 编辑 hdfs.path 值,

flume1.sinks.hdfs-sink-1.hdfs.path = hdfs://namenode_host:port/tmp/kafka/twitter_topic/%y-%m-%d

对于日志: 日志未打印在控制台上,删除 -Dflume.root.logger=INFO,console 之间的空格。

尝试,

bin/flume-ng agent -n flume1 -c conf -f conf/flume-conf.properties -Dflume.root.logger=INFO,console

或者从 $FLUME_HOME/logs/ 目录访问日志。

关于hadoop - 为什么我的 Flume 代理没有启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42669572/

相关文章:

hadoop - 没有文件匹配路径hdfs://nodemaster:9000/user/hive/beds%20

apache-kafka - 在 Keycloak 中使用第三方库

java - Apache Camel kafka 组件从 2.21.1 更新到 2.21.2 后无法序列化 header

node.js - 如何在node-rdkafka中一条一条读取消息

scribe - 水槽 vs 卡夫卡 vs 其他

hadoop - 如何提高水槽的性能

java - 如何让 Hadoop 客户端在安全 (Kerberos) 集群中使用正确的凭据

hadoop - 在 Airflow 中重用任务

apache-spark - Spark:在HDFS中创建的Paquet文件中日语字母乱码

apache - 启动Apache槽时为nullpointerexception