flume安装部署手册-new - 图文(3)

2019-03-29 15:57

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 [options]...

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 use configs in directory --classpath,-C append to the classpath

--dryrun,-d do not actually start Flume, just print the command -Dproperty=value sets a JDK system property value

agent options:

--conf-file,-f specify a config file (required)

--name,-n the name of this agent (required) --help,-h display help text

Flume-NG安装部署说明13 / 14

avro-client options:

--host,-H hostname to which events will be sent (required) --port,-p port of the avro source (required)

--filename,-F text file to stream to avro source [default: std input]

--headerFile,-R headerFile containing headers as key/value pairs on each new line --help,-h display help text

Note that if directory is specified, then it is always included first in the classpath.

5. 其它

本手册只对Apache Flume的简单数据流进行了配置(这种配置也是我们目前测试系统中使用的),Apache Flume还支持很多其它的配置方法,其它配置方法的描述请参见:

http://flume.apache.org/FlumeUserGuide.html

Flume-NG安装部署说明14 / 14


flume安装部署手册-new - 图文(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:三年级下册教科版科学月考试题及答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: