设为首页 加入收藏

TOP

跨平台多级Flume的部署
2018-11-28 18:08:02 】 浏览:112
Tags:跨平台 多级 Flume 部署

监控Windows平台下面文件的变化,然后将其搜集到Liunx中进行统一处理.

一个简单的示意图如下:


如果想达到这样的目的.Flume对Source和Sink的配置是有要求的.

如图,位于Windows上面的Flume Agent的Sink必须为avro或者thrift中的一种.

位于CentOS上面的Flume Agent的Source必须为avro或者thrift中的一种.

同时,如果使用avro,那么就需要都选择avro类型,不能一边选择avro类型,另一边选择thrift类型.

同时要注意关闭CentOS操作系统上面的防火墙.

[root@First ~]# service iptables stop

一、在windows和Liunx上面安装Flume-1.7.0.(JDK的安装略)

二、编辑Agent的配置文件。

Linux:

collect.properties

# 命名agent的组件。agent的名字为collect

collect.sources = r1

collect.sinks = k1

collect.channels = c1

# 配置source源。这个源必须是avro或者thrift

collect.sources.r1.type = avro

collect.sources.r1.bind = 0.0.0.0

collect.sources.r1.port = 44444

# 配置sink,此处选择的是logger

collect.sinks.k1.type = logger

# 配置channel,来缓存事件。此处选择的是memory

collect.channels.c1.type = memory

collect.channels.c1.capacity = 1000

collect.channels.c1.transactionCapacity = 100

# sourcesink绑定到channel上。

collect.sources.r1.channels = c1

collect.sinks.k1.channel = c1

Windows:

a1.properties

# 命名agent的组件。agent的名字为collect

a1.sources = r1

a1.sinks = k1

a1.channels = c1

# 配置source源。这个源是spooldir,根据项目的需要自由配置。

a1.sources.r1.type = spooldir

a1.sources.r1.spoolDir = D:/flumeTest

a1.sources.r1.deletePolicy = immediate

# 配置sink,必须为avro或者thrift,此处为avro

a1.sinks.k1.type = avro

a1.sinks.k1.hostname = 192.168.226.101

a1.sinks.k1.port = 44444

# 配置channel,来缓存事件。此处选择的是memory

a1.channels.c1.type = memory

a1.channels.c1.capacity = 1000

a1.channels.c1.transactionCapacity = 100

# sourcesink绑定到channel上。

a1.sources.r1.channels = c1

a1.sinks.k1.channel = c1

然后将文件保存在${FLUME_HOME}/conf文件夹下面。

三、启动Flume。

Liunx的启动命令(在Flume的根目录下面使用,各个参数不解释了,自行百度):

[root@First flume1.7]# bin/flume-ng agent -c conf -f conf/collect.properties -n collect -Dflume.root.logger=INFO,console

Windows的启动命令(在Flume的bin目录下面使用,使用的时候,注意该命令在windows和Liunx下面使用的区别):

E:\material\flume\windows_flume\apache-flume-1.7.0-bin\bin>flume-ng.cmd agent -c ../conf -f ../conf/a1.properties -n a1 -property flume.root.logger=INFO,console

四、测试

都启动成功以后,在agenta1监控的目录下,放入几个文本文件来测试。

Windows显示:

Linux显示:

如果需要在多个Windows上面配置Flume,那么过程的设置也是类似的。

需要注意的是,Windows上面的Agent的avro的IP地址和port一定要和Liunx上面的avro的port对应起来。并注意关闭Liunx的防火墙,不然会报错。



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇日志传输工具-Flume实现原理及应用 下一篇hadoop中flume框架遇到的一些问题..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目