一、安装
- 安装java,配置环境变量。
- 安装flume,下载地址,下载后直接解压即可。
二、运行
- 创建配置文件:在解压后的文件 apache-flume-1.7.0-bin\conf下创建一个example.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 = # 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 =
a1.channels.c1.transactionCapacity = # Bind the source and sink to the channel
a1.sources.r1.channels = c1
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窗口中,也会显示接收到的信息。 效果图(右键查看原图):