您的位置:首页 > 运维架构 > Apache

apache flume单机安装、运行

2016-12-14 18:12 375 查看
最近项目打算做一个日志收集功能,打算用flume,在这里开一个系列博客,记录我在实战用flume如何使用

官方下载flume,截止写这个博客时,官方最新1.7

https://flume.apache.org

下载到服务器,解压出来。

接在在conf文件夹中创建flume.conf文件,在flume.conf中写入以下sample内容,内容来自官网,只是用来做测试使用,请勿 放到生产

# example.conf: A single-node Flume configuration

# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = netcat
a1.sources.r1.bind = localhost
a1.sources.r1.port = 44444

# Describe the sink
a1.sinks.k1.type = logger

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1


接着执行启动命令

flume-ng agent --conf conf --conf-file flume.conf --name a1 -Dflume.root.logger=INFO,console


执行命令会显示下面内容

[root@esslog-shqs-4 conf]#flume-ng agent --conf conf --conf-file flume.conf --name a1 -Dflume.root.logger=INFO,console
Info: Including Hive libraries found via () for Hive access
+ exec /service/storm/jdk1.8.0_111/bin/java -Xmx20m -Dflume.root.logger=INFO,console -cp 'conf:/service/storm/flume/lib/*:/lib/*' -Djava.library.path= org.apache.flume.node.Application --conf-file flume.conf --name a1
log4j:WARN No appenders could be found for logger (org.apache.flume.lifecycle.LifecycleSupervisor).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.


纠结了半天,将命令改成如下

flume-ng agent --conf /service/storm/flume/conf --conf-file flume.conf --name a1 -Dflume.root.logger=INFO,console


–conf需要指定绝对路径。

调整配置再次启动,如下

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  apache flume 日志