flume 1.7在windows下的安装部署与测试运行
一、安装
- 安装java,配置环境变量。
- 安装flume,下载地址,下载后直接解压即可。
二、运行
- 创建配置文件:在解压后的文件 apache-flume-1.7.0-bin\conf下创建一个example.conf,内容如下
1 # example.conf: A single-node Flume configuration
2
3 # Name the components on this agent
4 a1.sources = r1
5 a1.sinks = k1
6 a1.channels = c1
7
8 # Describe/configure the source
9 a1.sources.r1.type = netcat
10 a1.sources.r1.bind = localhost
11 a1.sources.r1.port = 5555
12
13 # Describe the sink
14 a1.sinks.k1.type = logger
15
16 # Use a channel which buffers events in memory
17 a1.channels.c1.type = memory
18 a1.channels.c1.capacity = 1000
19 a1.channels.c1.transactionCapacity = 100
20
21 # Bind the source and sink to the channel
22 a1.sources.r1.channels = c1
23 a1.sinks.k1.channel = c1
2.打开cmd进入到apache-flume-1.7.0-bin\bin目录下,运行如下命令。
flume-ng.cmd agent -conf ../conf -conf-file ../conf/example.conf -name a1 -property flume.root.logger=INFO,console
运行效果如下图
3.另外打开一个cmd窗口,运行如下命令。
telnet localhost 5555
如果连接成功,则该窗口会变为输入状态,可以输入文字。同时在步骤2中的cmd窗口中,也会显示接收到的信息。 效果图(右键查看原图):