hadoop-企业版环境搭建(七)-fllume的搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/shursulei/article/details/79696383

一、启动zookpeer,hdfs.
二、解压配置flume
配置环境变量:

export JAVA_HOME=/usr/java/jdk1.7.0_79
export  HBASE_HOME=/home/hbase-1.1.3
export HIVE_HOME=/home/apache-hive-1.2.1-bin
export PATH=$PATH:$JAVA_HOME/bin:$HBASE_HOME/bin:$HIVE_HOME/bin:/home/apache-flume-1.6.0-bin/bin:/home/apache-flume-1.6.0-bin/bin

三、配置文件(source是被动类型的)

[root@node1 ~]# vi test1
添加内容:
# 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 = netcat#被动类型的
a1.sources.r1.bind = node1
a1.sources.r1.port = 44444

# Describe the sink
a1.sinks.k1.type = logger

# 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

补充:配置source是主动类型的
(看第五点)

这里写代码片

运行配置:

[root@node1 ~]# flume-ng agent --conf /home/apache-flume-1.6.0-bin/conf/  --conf-file test1 --name a1 -Dflume.root.logger=INFO,console

这里写图片描述
这里写图片描述
四、安装telnet
node3向node1发送消息。
这里写图片描述
node1会打印出,接受到的消息。
这里写图片描述
五、配置

[root@node1 ~]# vi test1 
[root@node1 ~]# cp test1 test2
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1

# Describe/configure the source
a1.sources.r1.type = spoolDir
a1.sources.r1.spoolDir = /opt/flume


# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path=hdfs://node1:8020/flume
a1.sinks.k1.hdfs.rollCount=0
a1.sinks.k1.hdfs.rollInterval=60
a1.sinks.k1.hdfs.rollSize=1024
a1.sinks.k1.hdfs.idleTimeout=3
a1.sinks.k1.hdfs.fileType=DataStream

# Use a channel which buffers events in memory
a1.channels.c1.type = memory
a1.channels.c1.capacity = 1000
a1.channels.c1.transact
ionCapacity = 100

# Bind the source and sink to the channel
a1.sources.r1.channels = c1
a1.sinks.k1.channel = c1

配置:

# 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 = spoolDir
a1.sources.r1.spoolDir = /opt/flume

# Describe the sink
a1.sinks.k1.type = hdfs
a1.sinks.k1.hdfs.path=hdfs://node1:8020/flume/%Y-%m-%d/%H%M
a1.sinks.k1.hdfs.rollCount=0
a1.sinks.k1.hdfs.rollInterval=60
a1.sinks.k1.hdfs.rollSize=1024
a1.sinks.k1.hdfs.idleTimeout=3
a1.sinks.k1.hdfs.fileType=DataStream
a1.sinks.k1.hdfs.useLocalTimeStamp=true
a1.sinks.k1.hdfs.round=true
a1.sinks.k1.hdfs.roundValue=5
a1.sinks.k1.hdfs.roundUnit=minute

# 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

运行:

[root@node1 ~]# flume-ng agent --conf /home/apache-flume-1.6.0-bin/conf/  --conf-file test2 --name a1 -Dflume.root.logger=INFO,console

猜你喜欢

转载自blog.csdn.net/shursulei/article/details/79696383