分享

Flume安装和使用说明

pig2 2013-11-12 21:42:20 发表于 安装配置 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 11 54797
1.flume简介

FlumeCloudera提供的日志收集系统,Flume支持在日志系统中定制各类数据发送方,用于收集数据;同时,Flume提供对数据进行简单处理,并写到各种数据接受方(可定制)的能力。
Flume是一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统。

2.安装和使用说明:
2.1 安装
a. 下载: http://archive.cloudera.com/cdh/3/ flume-0.9.0+1.tar.gz
接着解压.暂时用$flume代表解压路径.
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 <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
启动flumemaster节点执行:bin/flume master
通过flume打开文件
输入命令
$ flume dump 'tail("/home/hadoop/log/bb.txt")'
输出:
1.png


通过flume导入文件到hdfs
可打开http://10.1.27.30:35871/flumemaster.jsp 即可看到整理节点的情况
从上面URL打开的选项卡config,输入节点配置,然后点提交查询内容
如下:
2.png
Source为数据源,可有多种输入源,sink为接收器,当启动master节点时,会把文件写入到hdsf
启动配置好的节点:bin/flume node –n master
通过flume读取syslog-ng
3.png
分别启动节点hostcollector节点
3.9.png

4.png



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


本帖被以下淘专辑推荐:

已有(11)人评论

跳转到指定楼层
huidl 发表于 2013-12-22 20:07:03
强大,学习了!!感谢分享
回复

使用道具 举报

nettman 发表于 2014-1-16 01:06:38
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

小小布衣 发表于 2014-7-31 12:20:03
楼主请教一个问题,为什么我配置了环境变量后,还是会报这个问题[zhangxin@TUKMOB01 lib]$  flume node -n host
bash: flume: command not found
回复

使用道具 举报

小小布衣 发表于 2014-7-31 12:21:05
这个是完整的
[zhangxin@TUKMOB01 lib]$ which flume-ng
/tukmob/apache-flume-1.4.0-bin/bin/flume-ng
[zhangxin@TUKMOB01 lib]$ flume -version
bash: flume: command not found
[zhangxin@TUKMOB01 lib]$
回复

使用道具 举报

小小布衣 发表于 2014-7-31 12:22:41
这个是我的配置文件
export JAVA_HOME=/tukmob/jdk1.7.0_05
export HADOOP_HOME=/tukmob/hadoop-2.2.0
export HIVE_HOME=/tukmob/apache-hive-0.13.0-bin
export SQOOP_HOME=/tukmob/sqoop-1.4.4.bin__hadoop-2.0.4-alpha
export FLUME_HOME=/tukmob/apache-flume-1.4.0-bin
export FLUME_CONF_DIR=$FLUME_HOME/conf
export HBASE_HOME=/tukmob/hbase-0.96.2-hadoop2
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HIVE_HOME/bin:$SQOOP_HOME/bin:$FLUME_HOME/bin:$HBASE_HOME/bin
回复

使用道具 举报

小小布衣 发表于 2014-7-31 12:23:59
导致启动的时候报这个错
Info: Including HBASE libraries found via (/tukmob/hbase-0.96.2-hadoop2/bin/hbase) for HBASE access
Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty
回复

使用道具 举报

pig2 发表于 2014-7-31 12:42:38
本帖最后由 pig2 于 2014-7-31 12:50 编辑
小小布衣 发表于 2014-7-31 12:22
这个是我的配置文件
export JAVA_HOME=/tukmob/jdk1.7.0_05
export HADOOP_HOME=/tukmob/hadoop-2.2.0

使用的是flume-ng把
用下面命令试一下:
  1. flume-ng version
复制代码



回复

使用道具 举报

小小布衣 发表于 2014-7-31 14:13:12
pig2 发表于 2014-7-31 12:42
本帖最后由 pig2 于 2014-7-31 12:50 编辑

使用的是flume-ng把

[zhangxin@TUKMOB01 Downloads]$ flume-ng version
Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty
Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty
Error: Could not find or load main class org.apache.flume.tools.VersionInfo
[zhangxin@TUKMOB01 Downloads]$
看还是这样的

回复

使用道具 举报

小小布衣 发表于 2014-7-31 14:24:45
我发现问题了,这个flume在我的电脑上不稳定。我刚刚重新下载安装了之后,刚开始是好的,一个中之后全部不能用,这是怎么回事啊
[root@TUKMOB01 tukmob]# flume-ng version
Flume 1.4.0
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: 756924e96ace470289472a3bdb4d87e273ca74ef
Compiled by mpercy on Mon Jun 24 18:22:14 PDT 2013
From source with checksum f7db4bb30c2114d0d4fde482f183d4fe
[root@TUKMOB01 tukmob]# exit
exit
[zhangxin@TUKMOB01 flume-1.4.0]$ flume-ng version
Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty
Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty
Error: Could not find or load main class org.apache.flume.tools.VersionInfo
[zhangxin@TUKMOB01 flume-1.4.0]$ su root
回复

使用道具 举报

12下一页
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条