美文网首页
flume笔记

flume笔记

作者: 时待吾 | 来源:发表于2017-06-28 20:00 被阅读135次

flume 安装后基本的测试验证:

配置

source 使用 necat 类型,sink 采用 file_roll 类型, 从监听端口获取数据,保存到本地文件。 拷贝配置模板:

cp conf/flume-conf.properties.template conf/flume-conf.properties

编辑配置如下:

# 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 = r1

agent.channels = c1

agent.sinks = s1

# For each one of the sources, the type is defined

agent.sources.r1.type = netcat

agent.sources.r1.bind = localhost

agent.sources.r1.port = 8888

# The channel can be defined as follows.

agent.sources.r1.channels = c1

# Each sink's type must be defined

agent.sinks.s1.type = file_roll

agent.sinks.s1.sink.directory = /tmp/log/flume

#Specify the channel the sink should use

agent.sinks.s1.channel = c1

# Each channel's type is defined.

agent.channels.c1.type = memory

# Other config values specific to each type of channel(sink or source)

# can be defined as well

# In this case, it specifies the capacity of the memory channel

agent.channels.c1.capacity = 100

功能验证

1.建立输出目录

mkdir -p /tmp/log/flume

2.启动服务

bin/flume-ng agent --conf conf -f conf/flume-conf.properties -n agent&

运行日志位于logs目录,或者启动时添加-Dflume.root.logger=INFO,console 选项前台启动,输出打印日志,查看具体运行日志,服务异常时查原因。

3.发送数据

telnet localhost 8888

输入

helloworld!hello Flume!

4.查看数据文件 查看 /tmp/log/flume 目录文件:

# 文件名不同,需要根据实际情况修改和查看

cat /tmp/log/flume/1447671188760-2

hello world!hello Flume!

在修改配置后,一定要重启flume,否则配置无效。启动flume之后,与端口进行了绑定。再通过telnet向指定端口发送数据。假如,首先发送数据,然后配置重启flume,会报异常 org.apache.flume.FlumeException: java.net.BindException: Address already in use。

原因解析:如果首先发送数据,则发送端与该端口建立起了一个socket连接。当此时使用flume的netcat监听端口获取数据,则无法实现端口绑定。

虽然会一直报异常,但是对应的文件仍然会以一定的时间间隔生成或者文本大小生成。

相关文章

  • 大数据开发学习笔记——flume集成hive

    又是周五啦~ 分享完就回家过周末~_~ flume集成hive的笔记 1、 确定你的flume在哪台主机上 2、 ...

  • flume笔记

    最近要准备做一个系统监控小项目,简要分析了需求之后决定用当下比较火的flume-kafka-spark-sprin...

  • flume笔记

    flume 安装后基本的测试验证: 配置 source 使用 necat 类型,sink 采用 file_roll...

  • flume笔记

    Flume是一个高可用的,高可靠的,分布式的海量日志采集、聚合和传输的系统。 一、主要组件: 二、flume使用案例

  • Flume01

    Flume架构组成 Flume 负载均衡 Flume Agent内部原理 启动 Flume 监听

  • Flume

    总结 一、Flume的定义 1、flume的优势 2、flume的组成 3、flume的架构 二、 flume部署...

  • 玩转大数据计算之Flume

    Flume版本:我们使用Flume最新的版本:Flume NG 1.7.0 Flume架构Flume是一个分布式的...

  • Flume学习笔记

    官方文档 核心组件 Source 收集 Channel 聚集 Sink 输出 Flume 安装前置条件 Java ...

  • Flume学习笔记

    本文是对大数据组件Flume的一个学习总结,共包括如下章节的内容: 简介 核心概念 使用场景 快速起步 小结 一、...

  • flume学习笔记

    0. 安装 下载 wget http://apache.fayea.com/flume/1.7.0/apache-...

网友评论

      本文标题:flume笔记

      本文链接:https://www.haomeiwen.com/subject/magycxtx.html