如何在Linux中将日志文件从Windows 7流式传输到HDFS?
Windows中的Flume错误
我在Windows 7(节点1)上安装了'flume-node-0.9.3'。 'flumenode'服务正在运行,localhost:35862可以访问。
在Windows中,日志文件位于“C:/logs/Weblogic.log”
CentOS Linux(节点2)中的Flume代理也在运行。
以下是位于Windows 7(节点1)上Flume的'conf'文件夹中的 flume-src.conf 文件
source_agent.sources = weblogic_server
source_agent.sources.weblogic_server.type = exec
source_agent.sources.weblogic_server.command = tail -f C:/logs/Weblogic.log
source_agent.sources.weblogic_server.batchSize = 1
source_agent.sources.weblogic_server.channels = memoryChannel
source_agent.sources.weblogic_server.interceptors = itime ihost itype
source_agent.sources.weblogic_server.interceptors.itime.type = timestamp
source_agent.sources.weblogic_server.interceptors.ihost.type = host
source_agent.sources.weblogic_server.interceptors.ihost.useIP = false
source_agent.sources.weblogic_server.interceptors.ihost.hostHeader = host
source_agent.sources.weblogic_server.interceptors.itype.type = static
source_agent.sources.weblogic_server.interceptors.itype.key = log_type
source_agent.sources.weblogic_server.interceptors.itype.value = apache_access_combined
source_agent.channels = memoryChannel
source_agent.channels.memoryChannel.type = memory
source_agent.channels.memoryChannel.capacity = 100
source_agent.sinks = avro_sink
source_agent.sinks.avro_sink.type = avro
source_agent.sinks.avro_sink.channel = memoryChannel
source_agent.sinks.avro_sink.hostname = 10.10.201.40
source_agent.sinks.avro_sink.port = 41414
我尝试通过在Flume文件夹中执行以下命令来运行上述文件:
C:\Program Files\Cloudera\Flume 0.9.3>"C:\Program Files\Java\jre7\bin\java.exe"
-Xmx20m -Dlog4j.configuration=file:///%CD%\conf\log4j.properties -cp "C:\Program Files\Cloudera\Flume 0.9.3\lib*" org.apache.flume.node.Application
-f C:\Program Files\Cloudera\Flume 0.9.3\conf\flume-src.conf -n source_agent
但它提供了以下信息:
Error: Could not find or load main class Files\Cloudera\Flume
以下是在CentOS(节点2)中运行的 trg-node.conf 文件。 CentOS节点工作正常:
collector.sources = AvroIn
collector.sources.AvroIn.type = avro
collector.sources.AvroIn.bind = 0.0.0.0
collector.sources.AvroIn.port = 41414
collector.sources.AvroIn.channels = mc1 mc2
collector.channels = mc1 mc2
collector.channels.mc1.type = memory
collector.channels.mc1.capacity = 100
collector.channels.mc2.type = memory
collector.channels.mc2.capacity = 100
collector.sinks = HadoopOut
collector.sinks.HadoopOut.type = hdfs
collector.sinks.HadoopOut.channel = mc2
collector.sinks.HadoopOut.hdfs.path =/user/root
collector.sinks.HadoopOut.hdfs.callTimeout = 150000
collector.sinks.HadoopOut.hdfs.fileType = DataStream
collector.sinks.HadoopOut.hdfs.writeFormat = Text
collector.sinks.HadoopOut.hdfs.rollSize = 0
collector.sinks.HadoopOut.hdfs.rollCount = 10000
collector.sinks.HadoopOut.hdfs.rollInterval = 600
答案 0 :(得分:2)
问题是由于此路径中程序和文件之间的空白区域:
C:**程序文件** \ Cloudera \ Flume 0.9.3
考虑在没有空格的路径中安装Flume,它会像魅力一样工作。