因缺失log4j.properties 配置文件导致flume无法正常启动。

                因缺失log4j.properties 配置文件导致flume无法正常启动

                                           作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

 

一.报错:log4j:WARN No appenders could be found for logger (org.apache.flume.lifecycle.LifecycleSupervisor).

[root@flume120 ~]# cat /yinzhengjie/data/flume/job/flume-telnet.conf 
# 这里的“yinzhengjie”是agent的名称,它是我们自定义的。我们分别给“yinzhengjie”的sources,sinks,channels的别名分别为r1,k1和c1。
yinzhengjie.sources = r1
yinzhengjie.sinks = k1
yinzhengjie.channels = c1

# 指定source的类型为netcat(source的type有很多,咱们不用记住它,需要用的时候去官网查就好),绑定source的主机是“node106.yinzhengjie.org.cn”,绑
定的端口为“8888”
yinzhengjie.sources.r1.type = netcat
yinzhengjie.sources.r1.bind = flume120.aggrx
yinzhengjie.sources.r1.port = 8888

# 指定sink的类型,我们这里指定的为logger,即控制台输出。
yinzhengjie.sinks.k1.type = logger

# 指定channel的类型为memory,指定channel的容量是1000,每次传输的容量是100
yinzhengjie.channels.c1.type = memory
yinzhengjie.channels.c1.capacity = 1000
yinzhengjie.channels.c1.transactionCapacity = 100

# 绑定source和sink
yinzhengjie.sources.r1.channels = c1
yinzhengjie.sinks.k1.channel = c1
[root@flume120 ~]# 
/yinzhengjie/data/flume/job/flume-telnet.conf               配置文件内容 
[root@flume120 ~]# ll /yinzhengjie/data/flume/job/
total 4
-rw-r--r-- 1 root root 1003 Oct 16 20:10 flume-telnet.conf
[root@flume120 ~]# 
[root@flume120 ~]# flume-ng agent -c /yinzhengjie/data/flume/job/ --conf-file=/yinzhengjie/data/flume/job/flume-telnet.conf  -name yinzhengjie -Dflume.root.logger=INFO,console
Warning: JAVA_HOME is not set!
Info: Including Hive libraries found via () for Hive access
+ exec /soft/jdk/bin/java -Xmx20m -Dflume.root.logger=INFO,console -cp '/yinzhengjie/data/flume/job:/soft/flume/lib/*:/lib/*' -Djava.library.path= org.apache.flume.node.Application --conf-file=/yinzhengjie/data/flume/job/flume-telnet.conf -name yinzhengjie
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.

  上面也告诉你解决方案啦,就是让你初始化:“log4j”这个配置文件。解决方案就是将你安装的flume软件conf目录中的“log4j.properties”文件拷贝到我们上面使用“--conf”指定到路径:“/yinzhengjie/data/flume/job/”

[root@flume120 ~]# ll  /yinzhengjie/data/flume/job/
total 4
-rw-r--r-- 1 root root 1003 Oct 16 20:10 flume-telnet.conf
[root@flume120 ~]# 
[root@flume120 ~]# cp /soft/apache-flume-1.7.0-bin/conf/log4j.properties /yinzhengjie/data/flume/job/           #将log4j.properties文件拷贝过来。
[root@flume120 ~]# 
[root@flume120 ~]# ll  /yinzhengjie/data/flume/job/
total 8
-rw-r--r-- 1 root root 1003 Oct 16 20:10 flume-telnet.conf
-rw-r--r-- 1 root root 3107 Oct 16 20:15 log4j.properties
[root@flume120 ~]# 

  执行以上操作后,服务可以正常启动啦。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值