分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

flume安装配置

发布时间:2023-09-06 01:57责任编辑:蔡小小关键词:配置

flume安装配置

一:下载

下载地址:http://www.apache.org/dyn/closer.lua/flume/1.8.0/apache-flume-1.8.0-bin.tar.gz

二:解压

[root@s100 ~]# tar -zxvf apache-flume-1.8.0-bin.tar.gz -C /usr/local/

改名为flume方便以后操作

[root@s100 local]# pwd/usr/local[root@s100 local]# lsapache-flume-1.8.0-bin ?etc ???hadoop ?hive ?????include ?lib ???libexec ?sharebin ????????????????????games ?hbase ??hive.bak ?java ????lib64 ?sbin ????src[root@s100 local]# mv apache-flume-1.8.0-bin flume

三:配置环境变量

[root@s100 conf]# vim /etc/profile
 #flume export FLUME_HOME=/usr/local/flume export PATH=$PATH:$FLUME_HOME/bin

执行:

[root@s100 conf]# source /etc/profile

四:配置flume

[root@s100 conf]# pwd/usr/local/flume/conf[root@s100 conf]# lsflume-conf.properties.template ?flume-env.sh.templateflume-env.ps1.template ?????????log4j.properties

在flume的配置文件下有一个 flume-conf.properties.template 文件,里面是关于flume配置的模板

根据模板文件,我们配置一个netcat并使用flume收集日志

[root@s100 conf]# vim r_nc.conf

根据模板内容,配置信息如下:

# The configuration file needs to define the sources, # the channels and the sinks.# Sources, channels and sinks are defined per agent, # in this case called ‘agent‘#声明三类组件agent.sources = r1agent.channels = c1agent.sinks = k1#配置source-r1组件agent.sources.r1.type = netcatagent.sources.r1.bind = localhostagent.sources.r1.port = 10000#端口号,启动成功有提示#配置channel-c1组件agent.channels.c1.type = memory#配置sink-k1组件agent.sinks.k1.type = logger#绑定:注意r1和k1后面的sagent.sources.r1.channels = c1agent.sinks.k1.channel = c1

五:flume启动

[root@s100 conf]# flume-ng agent -f r_nv.conf -n agent -Dflume.root.logger=INFO.console

格式:flume-ng agent -f 指定文件名称(地址,这里因为r_nv.conf是在conf下,所以是跟的r_nv.conf) -n 名称(就是agent.sources = r1中的agent)-Dflume.root.logger=INFO.consloe

...
18/05/25 15:42:56 INFO node.Application: Starting Sink k118/05/25 15:42:56 INFO node.Application: Starting Source r118/05/25 15:42:56 INFO source.NetcatSource: Source starting18/05/25 15:42:56 INFO source.NetcatSource: Created serverSocket:sun.nio.ch.ServerSocketChannelImpl[/127.0.0.1:10000]

这里有127.0.0.1:10000表示启动成功

六:本机的flume端口查询和flume的结果

打开一个新的shell窗口(不要关闭原来的flume,因为我们将数据校验过程打印在console中)

[root@s100 ~]# netstat -anpt | grep 1000tcp ???????0 ?????0 ::ffff:127.0.0.1:10000 ?????:::* ???????????????????????LISTEN ?????59845/java ????

端口存在

flume日志监控结果查询

注意:Ubuntu下安装netcat:apt-get -y install netcat-traditional

 在netcat服务存在的情况下执行:[root@s100 ~]# nc localhost 10000


 本文版权声明:

 本文作者:魁·帝小仙

 博文主页地址:http://www.cnblogs.com/dxxblog/

 欢迎对小博主的博客内容批评指点,如果问题,可评论或邮件联(2335228250@qq.com)

 欢迎转载,转载请在文章页面明显位置给出原文链接,谢谢

flume安装配置

原文地址:https://www.cnblogs.com/dxxblog/p/9104960.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved