您现在的位置 >> Hadoop教程 >> Hadoop实战 >> flume专题  
 

Flume安装和使用说明

【作者:Hadoop实战专家】【关键词:节点 host 数据 】 【点击:77371次】【2013-09-0】
Similar to tail source but follows multiple files. port, port. This is syslog compatible. Console sink. Textfile sink. Write serialized Flume events to a dfs path such as hdfs://namenode/file or file:///file in Hadoop’s seqfile format.  

相关热门搜索:hadoop 删除节点步骤 hadoop节点 hadoop 删除节点

大数据标签:hadoop hdfs hive zookeeper flume bigdata

1.flume简介

Flume是Cloudera提供的日志收集系统,Flume支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受方(可定制)的能力。

Flume是一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统。

2.安装和使用说明:

2.1 安装

a. 下载: http://archive.cloudera.com/cdh/3/ flume-0.9.0+1.tar.gz

接着解压.暂时用$flume代表解压路径.

b. 用户文档:http://archive.cloudera.com/cdh/3/flume/UserGuide.html

c. 下载: http://archive.cloudera.com/cdh/3/ zookeeper-3.3.1.tar.gz

d. 安装zookeeper

yum install hadoop-zookeeper –y

yum install hadoop-zookeeper-server –y

修改/zookeeper-3.3.1/conf/ zoo_sample.cfg重命名为zoo.cfg

执行如下命令:

export  ZOOKEEPER_HOME=/home/hadoop/zookeeper-3.3.1

export  FLUME_HOME=/home/hadoop/flume-0.9.0+1

export  PATH=.:$FLUME_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH

2.2 使用

执行>flume

输出如下:

usage: flume command [args...]

commands include:

dump            Takes a specified source and dumps to console

node            Start a Flume node/agent (with watchdog)

master          Start a Flume Master server (with watchdog)

version         Dump flume build version information

node_nowatch    Start a flume node/agent (no watchdog)

master_nowatch  Start a Flume Master server (no watchdog)

class    Run specified fully qualified class using Flume environment (no watchdog)

ex: flume com.cloudera.flume.agent.FlumeNode

classpath       Dump the classpath used by the java executables

shell           Start the flume shell

启动flume的master节点执行:bin/flume master

通过flume打开文件

输入命令

$ flume dump 'tail("/home/hadoop/log/bb.txt")'

输出:

1.png (12.53 KB, 下载次数: 0)

  

2013-11-12 21:41 上传

通过flume导入文件到hdfs

可打开http://10.1.27.30:35871/flumemaster.jsp 即可看到整理节点的情况

从上面URL打开的选项卡config,输入节点配置,然后点提交查询内容

如下:

2.png (23.56 KB, 下载次数: 0)

  

2013-11-12 21:41 上传

Source为数据源,可有多种输入源,sink为接收器,当启动master节点时,会把文件写入到hdsf里

启动配置好的节点:bin/flume node –n master

通过flume读取syslog-ng

3.png (25.48 KB, 下载次数: 0)

  

2013-11-12 21:41 上传

分别启动节点host和collector节点

3.9.png (17.1 KB, 下载次数: 0)

  

2013-11-12 21:41 上传

4.png (26.96 KB, 下载次数: 0)

  

2013-11-12 21:41 上传

3.附录:

Flume Event

Sources console

Stdin console

text("filename")

One shot text file source. One line is one event

tail("filename")

Similar to Unix’s tail -F. One line is one event. Stays open for more data and follows filename if file rotated.

multitail("file1"[, "file2"[, …]])

Similar to tail source but follows multiple files.

asciisynth(msg_count,msg_size)

A source that synthetically generates msg_count random messages of size msg_size. This converts all characters into printable ASCII characters.

syslogUdp(port)

Syslog over UDP port, port. This is syslog compatible.

syslogTcp(port)

Syslog over TCP port, port. This is syslog-ng compatible.

Flume Event Sinks

null

Null sink. Events are dropped.

console[("format")]

Console sink. Display to console’s stdout. The "format" argument is optional and defaults to the "debug" output format.

text("txtfile"[,"format"])

Textfile sink. Write the events to text file txtfile using output format "format". The default format is "raw" event bodies with no metadata.

dfs("dfsfile")

DFS seqfile sink. Write serialized Flume events to a dfs path such as hdfs://namenode/file or file:///file in Hadoop’s seqfile format. Note that because of the hdfs write semantics, no data for this sink write until the sink is closed.

syslogTcp("host",port)

Syslog TCP sink. Forward to events to host on TCP port port in syslog wire format (syslog-ng compatible), or to other Flume nodes setup to listen for syslogTcp.

默认端口如下:

TCP ports are used in all situations.

node collector port

flume.collector.port

35853+

node status web server

flume.node.http.port

35862+

master status web server

flume.master.http.port

35871

master heartbeat port

flume.master.heartbeat.port

35872

master admin/shell port

flume.master.admin.port

35873

master gossip port

flume.master.gossip.port

35890

master → zk port

flume.master.zk.client.port

3181

zk → zk quorum port

flume.master.zk.server.quorum.port

3182

zk → zk election port

flume.master.zk.server.election.port

3183

大数据系列flume相关文章:

最新评论
黑冰2014-09-10 10:13:40
@落夜 大神好
verser2014-09-09 10:02:50
广州Java培训gzitcastcn之OA项目实现基本的增删改查
fz2014-09-08 07:55:58
看Netflix是如何良性融合AWS和Apache Hadoop的!-CSDN.NET http://t.cn/8kg0AXS
期待,你?2014-09-08 01:01:50
我现在要做一个操作,去A表的100w条数据,和B表的100w条数据进行匹对,然后比对上的更新状态
hadoop_d2014-09-08 06:27:14
javac -classpath的时候不是要指定用到的jar包嘛,share里面jar太多,不知道用哪个
芳芳2014-09-07 04:28:18
[图片]还是的
萱梓2014-09-06 06:07:12
做为传统关系型数据库的管理者,有一小撮嗅觉敏锐的DBA也对Hadoop的世界满怀激情和向往,也在通往Hadoop的道路上跃跃欲试。本文将根据SWOT理论,分析传统DBA向Hadoop转型的方方面面。 By 贾传青 http://t.cn/RvpHcQy
随风落叶2014-09-05 01:05:20
at org.apache.hadoop.hbase.protobuf.generated.ClientProtos$ClientService$BlockingStub.scan(ClientProtos.java:29990)
twocoal2014-09-05 09:51:29
Using Hadoop for Video Streaming http://t.cn/8sgV8sA
sunnybuaa2014-09-04 06:40:13
2013年的Hadoop峰会上,YARN是一个热点话题,YARN本质上是Hadoop的新操作系统,突破了MapReduce框架的性能瓶颈。Murthy认为Hadoop和YARN的组合是企业大数据平台致胜的关键。 zHkWwb3
 
  • Hadoop生态系统资料推荐