黑猴子的家:Flume 案例 控制台 demo

Flume监控一端Console,另一端Console发送消息,使被监控端实时显示。

1、创建flume Agent配置文件flume-telnet.conf

# 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 = hadoop102
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

2、判断44444端口是否被占用

[root@hadoop102 ~]# netstat -tunlp | grep 44444

3、先开启Flume监听端口

[victor@hadoop102 ~]$ bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-telnet.conf -Dflume.root.logger==info,console

4、使用telnet工具向本机的44444端口发送内容

[victor@hadoop102 ~]$ telnet hadoop102 44444

你可能感兴趣的:(Flume)