1. 下载并解压Flume
[root@langzi01 ~]# wget http://www.apache.org/dyn/closer.lua/flume/1.8.0/apache-flume-1.8.0-bin.tar.gz
[root@langzi01 ~]# tar -zxvf apache-flume-1.8.0-bin.tar.gz
#重命名
[root@langzi01 ~]# mv apache-flume-1.8.0-bin /usr/soft/flume
2. 修改配置文件
[hadoop@langzi01 conf]$ pwd
#/usr/soft/flume/conf
[hadoop@langzi01 conf]$ cp flume-conf.properties.template flume.conf
[hadoop@langzi01 conf]$ vim flume.conf
内容如下:
# 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 = localhost
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
3. 启动flume
[hadoop@langzi01 conf]$ ../bin/flume-ng agent --conf conf --conf-file flume-conf.properties --name a1 -Dflume.root.logger=INFO,console
4. 链接flume
$ telnet localhost 44444
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Hello world! <ENTER>
OK