1.下载flume的tar包并解压
https://ccp.cloudera.com/display/SUPPORT/CDH3+Downloadable+Tarballs
2.配置FLUME_HOME和FLUME_CONF_DIR变量
vim /etc/profile.d/cluster.sh export FLUME_HOME=/home/eryk/soft/flume export FLUME_CONF_DIR=/home/eryk/data/flume/conf export PATH=$FLUME_HOME/bin:$PATH
使变量生效
source /etc/profile.d/cluster.sh
输入flume,返回如下结果:
eryk@eryk-Inspiron-1520:~$ flume usage: flume command [args...] commands include: dump Takes a specified source and dumps to console source 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 killmaster Kill a running master dumplog Takes a specified WAL/DFO log file and dumps to console sink Start a one-shot flume node with console source and specified sink
3."hello flume"
flume dump console
这样就启动了一个从命令行接收数据的flume node,运行时生成的文件在/tmp/flume下(通过flume.agent.logdir参数修改文件路径),请确认当前用户对/tmp目录有操作权限。启动完成后,在当前命令行输入“hello flume”,返回如下结果:
hello flume eryk-Inspiron-1520 [INFO Sun Apr 22 20:18:15 CST 2012] hello flume