4.2. 启动Apache Flume Client
Apache Flume Client可以运行在任何安装有Apache Flume环境的主机上,只要和运行Apache Flume Agent的主机网络上相通。 运行命令如下:
flume-ng avro-client -H \
我们在测试环境中针对Apache Flume Client的启停编写了shell脚本,该脚本会将运行目录下所有的文件传输到Apache Flume Agent。启动脚本如下:
#!/bin/bash
local_file_dir=/home/hadoop/mr_data/hw
local_bak_dir=/home/hadoop/mr_data/back_up/hw avro_host=10.32.147.241 avro_port=4141
status_file=/home/hadoop/apache-flume-1.2.0/conf/status_file
Flume-NG安装部署说明11 / 14
if [ ! -d \
echo \ exit 1 fi
if [ ! -d \
echo \ exit 2 fi
if [ ! -f \ touch \
echo $(date) > \fi
echo \cd \if [ 0 -ne $? ]; then
echo \ exit 3 fi
while [ -f $status_file ] do
for filename in $(ls -lrt | awk '{print $9}') do
echo \
if [ \ continue fi
if [[ -n \ echo \
flume-ng avro-client -H \-p \-filename
\
echo \
mv \ fi done
sleep 10
done
Flume-NG安装部署说明12 / 14
停止脚本如下:
#!/bin/bash
status_file=status_file
echo \
if [ -f \ rm -f \ if [ 0 -eq $? ]; then
echo \ else
echo \ fi else
echo \fi
4.3. 停止Apache Flume
Apache Flume并没有提供停止的命令,所以要停止Apache Flume需要kill进程号
[hadoop@cassdb 20120917]$ ps -ef | grep flume [hadoop@cassdb 20120917]$ kill -9 进程号
4.4. Apache Flume命令
Usage: ./flume-ng
commands:
help display this help text agent run a Flume agent avro-client run an avro Flume client version show Flume version info
global options:
--conf,-c
--dryrun,-d do not actually start Flume, just print the command -Dproperty=value sets a JDK system property value
agent options:
--conf-file,-f
--name,-n
Flume-NG安装部署说明13 / 14
avro-client options:
--host,-H
--filename,-F
--headerFile,-R
Note that if
5. 其它
本手册只对Apache Flume的简单数据流进行了配置(这种配置也是我们目前测试系统中使用的),Apache Flume还支持很多其它的配置方法,其它配置方法的描述请参见:
http://flume.apache.org/FlumeUserGuide.html
Flume-NG安装部署说明14 / 14