Flume使用namespace操作

来源:互联网 发布:美甲软件 编辑:程序博客网 时间:2024/05/16 13:56

 参考:

(1)官方文档:http://flume.apache.org/FlumeUserGuide.html

(2)中文文档:http://download.csdn.net/download/high2011/9812414

1举例

(1)编辑flume-conf.properties文件

内容如下:

# example.conf: A single-node Flume configuration

 

# Name the components on this agent

a1.sources = r1

a1.sinks = k1

a1.channels = c1

 

# Describe/configure the source

a1.sources.r1.type = exec

a1.sources.r1.command= tail -F /home/jifei_yang/testflume/data_dir/taildata/tailflume.txt

 

# Describe the sink

a1.sinks.k1.type = hdfs

#hdfs sink间隔多长将临时文件滚动成最终目标文件,单位:秒;

a1.sinks.k1.hdfs.rollInterval= 60

a1.sinks.k1.hdfs.rollSize= 0

a1.sinks.k1.hdfs.rollCount= 0

a1.sinks.k1.hdfs.path= hdfs://nameservice1test/user/piqiang_wei/testflume/%Y-%m-%d-%H  

a1.sinks.k1.hdfs.useLocalTimeStamp= true

a1.sinks.k1.hdfs.fileType= DataStream

#当目前被打开的临时文件在该参数指定的时间(秒)内,没有任何数据写入,

#则将该临时文件关闭并重命名成目标文件;

a1.sinks.k1.hdfs.idleTimeout= 30

a1.sinks.k1.hdfs.kerberosPrincipal= log2hadoop

a1.sinks.k1.hdfs.kerberosKeytab= /home/jifei_yang/testflume/conf/log2hadoop_bgp_apple.keytab

 

 

# Use a channel which buffers events in memory

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactionCapacity = 100

 

# Bind the source and sink to the channel

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

 2、注意

(1)、红色是需要在原来的基础上修改的地方

将原来的ip:8020-----》nameservice1test(命名空间)

(2)、提交命令

flume-ng agent  --conf  /home/jifei_yang/testflume/configs/piqiang_wei  --conf-file  /home/jifei_yang/testflume/my_properties/flume-conf.properties --name a1    -Dflume.root.logger=DEBUG,console

 

红色部分是新添加的配置目录,需要创建!


 (3)、在目录下添加xml文件

目录:/home/jifei_yang/testflume/configs/piqiang_wei

文件:

 

 

 

这些文件是在namenode所在机器的目录(/etc/Hadoop/conf)下获取!


注:测试通过,可以按需修改使用!



1 0