源码包下载:

http://archive.apache.org/dist/flume/1.8.0/

集群环境:

master 192.168.1.99
slave1 192.168.1.100
slave2 192.168.1.101

下载安装包:

# Master
wget http://archive.apache.org/dist/flume/1.8.0/apache-flume-1.8.0-bin.tar.gz -C /usr/local/src
tar -zxvf apache-flume-1.8.0-bin.tar.gz
mv apache-flume-1.8.0-bin /usr/local/flume

Flume配置:

#Netcat

cd /usr/local/flume/conf

vim flume-netcat.conf

# Name the components on this agent
agent.sources = r1
agent.sinks = k1
agent.channels = c1 # Describe/configuration the source
agent.sources.r1.type = netcat
agent.sources.r1.bind = master
agent.sources.r1.port = #Describe the sink
agent.sinks.k1.type = logger # Use a channel which buffers events in memory
agent.channels.c1.type = memory
agent.channels.c1.capacity =
agent.channels.c1.transactionCapacity = # Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

验证:

服务端:
/usr/local/flume/bin/flume-ng agent -f flume-netcat.conf -n agent -Dflume.root.logger=INFO, console 客户端:
telnet master 44444

结果如图:

#Exec

cd /usr/local/flume/conf

vim flume-exec.conf

# Name the components on this agent
agent.sources = r1
agent.sinks = k1
agent.channels = c1 # Describe/configuration the source
agent.sources.r1.type = exec
agent.sources.r1.command = tail -f /root/test.log #Describe the sink
agent.sinks.k1.type = logger # Use a channel which buffers events in memory
agent.channels.c1.type = memory
agent.channels.c1.capacity =
agent.channels.c1.transactionCapacity = # Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

验证:

服务端
/usr/local/flume/bin/flume-ng agent -f flume-exec.conf -n agent -Dflume.root.logger=INFO, console 客户端
echo "wangzai" > /root/test.log

结果如图:

 #HDFS

cd /usr/local/flume/conf

vim flume-exec-hdfs.conf

# Name the components on this agent
agent.sources = r1
agent.sinks = k1
agent.channels = c1

# Describe/configuration the source
agent.sources.r1.type = exec
agent.sources.r1.command = tail -f /root/test.log
agent.sources.r1.shell = /bin/bash -c

#Describe the sink
agent.sinks.k1.type = hdfs
agent.sinks.k1.hdfs.path = hdfs://master:9000/data/flume/tail
agent.sinks.k1.hdfs.fileType=DataStream
agent.sinks.k1.hdfs.writeFormat=Text

## hdfs sink间隔多长将临时文件滚动成最终目标文件,单位:秒,默认为30s
## 如果设置成0,则表示不根据时间来滚动文件;
# agent.sinks.k1.hdfs.rollInterval = 0
## 表示到134M的时候回滚到下一个文件
#agent.sinks.k1.hdfs.rollSize = 134217728
#agent.sinks.k1.hdfs.rollCount = 1000000
#agent.sinks.k1.hdfs.batchSize=10

# Use a channel which buffers events in memory
agent.channels.c1.type = memory
#agent.channels.c1.capacity = 1000
#agent.channels.c1.transactionCapacity = 100

# Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

验证:

服务端
/usr/local/flume/bin/flume-ng agent -f flume-exec-hdfs.conf -n agent -Dflume.root.logger=INFO, console 客户端
echo "wangzai" > /root/test.log

结果如图:

#Kafka

cd /usr/local/flume/conf

vim flume-exec-kafka.conf

# Name the components on this agent
agent.sources = r1
agent.sinks = k1
agent.channels = c1 # Describe/configuration the source
agent.sources.r1.type = exec
agent.sources.r1.command = tail -f /root/test.log
agent.sources.r1.shell = /bin/bash -c ## kafka
#Describe the sink
agent.sinks.k1.type = org.apache.flume.sink.kafka.KafkaSink
agent.sinks.k1.topic = kafkatest
agent.sinks.k1.brokerList = master:
agent.sinks.k1.requiredAcks =
agent.sinks.k1.batchSize = # Use a channel which buffers events in memory
agent.channels.c1.type = memory
agent.channels.c1.capacity =
#agent.channels.c1.transactionCapacity = # Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

验证:

启动kafka,创建topic

/usr/local/kafka/bin/kafka-server-start.sh /usr/local/kafka/config/server.properties > /dev/null &
kafka-topics.sh --create --zookeeper master:,slave1:,slave2: --replication-factor --partitions --topic kafkatest

启动flume以及测试

服务端
/usr/local/flume/bin/flume-ng agent -f flume-exec-kafka.conf -n agent -Dflume.root.logger=INFO, console 客户端
echo "wangzai" > test.log

启动kafka客户端

/usr/local/kafka/bin/kafka-console-consumer.sh --zookeeper master:,slave1:,slave2: --topic kafkatest --from-beginning

结果如图:

flume服务端:

kafka客户端:

Flume环境安装的更多相关文章

  1. Flume1 初识Flume和虚拟机搭建Flume环境

    前言:       工作中需要同步日志到hdfs,以前是找运维用rsync做同步,现在一般是用flume同步数据到hdfs.以前为了工作简单看个flume的一些东西,今天下午有时间自己利用虚拟机搭建了 ...

  2. 日志采集框架Flume以及Flume的安装部署(一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统)

    Flume支持众多的source和sink类型,详细手册可参考官方文档,更多source和sink组件 http://flume.apache.org/FlumeUserGuide.html Flum ...

  3. Flume环境搭建_五种案例

    Flume环境搭建_五种案例 http://flume.apache.org/FlumeUserGuide.html A simple example Here, we give an example ...

  4. 日志收集框架flume的安装及简单使用

    flume介绍 Flume是一个分布式.可靠.和高可用的海量日志采集.聚合和传输的系统. Flume可以采集文件,socket数据包等各种形式源数据,又可以将采集到的数据输出到HDFS.hbase.h ...

  5. Flume环境搭建_五种案例(转)

    Flume环境搭建_五种案例 http://flume.apache.org/FlumeUserGuide.html A simple example Here, we give an example ...

  6. 02_ Flume的安装部署及其简单使用

    一.Flume的安装部署: Flume的安装非常简单,只需要解压即可,当然,前提是已有hadoop环境 安装包的下载地址为:http://www-us.apache.org/dist/flume/1. ...

  7. Flume介绍安装使用

    APache Flume官网:http://flume.apache.org/releases/content/1.9.0/FlumeUserGuide.html#memory-channel 目录 ...

  8. Flume 组件安装配置

    下载和解压 Flume 实验环境可能需要回至第四,五,六章(hadoop和hive),否则后面传输数据可能报错(猜测)! 可 以 从 官 网 下 载 Flume 组 件 安 装 包 , 下 载 地 址 ...

  9. 使用专业的消息队列产品rabbitmq之centos7环境安装

      我们在项目开发的时候都不可避免的会有异步化的问题,比较好的解决方案就是使用消息队列,可供选择的队列产品也有很多,比如轻量级的redis, 当然还有重量级的专业产品rabbitmq,rabbitmq ...

随机推荐

  1. /etc/hostname

    我们可以使用 hostname 命令来修改主机名,但只是临时生效,如果想永久生效可以编辑 /etc/hostname 文件,注意不是每个 Linux 发行版都有该文件 root@Ubuntu_Lee: ...

  2. iOS开发 - 检测网络状态(WIFI、2G/3G/4G)

    本文转载至 http://blog.csdn.net/wangzi11322/article/details/45580917 检测网络状态 在网络应用中,需要对用户设备的网络状态进行实时监控,目的是 ...

  3. NSFileManager和NSFileHandle(附:获取文件大小 )

    本文转载至:http://www.cnblogs.com/pengyingh/articles/2350345.html 天牛 感谢原创作者的硕果 //file 文件操作 NSFileManager  ...

  4. combobox组合框

    最近在改BUG的时候发现,combobox组合框如果选择的是Dropdown模式在初始化combobox对象时候有如下操作 1.SetDlgItemInt(IDC_WB_FONTSIZECOMBOX, ...

  5. 使用OpenRowSet操作Excel Excel导入数据库

    使用 OpenRowSet 和 OpenDataSource 访问 Excel 97-2007 测试文件:D:\97-2003.xls和D:\2007.xlsx,两个文件的内容是一模一样的. 测试环境 ...

  6. Shell 将两个文件按列合并

    file1. 1 2 2 3 3 4 4 5 5 6 file2. a b b c c d d e e f 需要把file2的第二列合并到file1,使File1并成三列. 第一种方法:paste p ...

  7. LeetCode——Pascal's Triangle II

    Description: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3 ...

  8. {sharepoint} More on SharePoint 2010 Application Pools

    More on SharePoint 2010 Application Pools Print | posted on Friday, December 04, 2009 3:26 PM Blimey ...

  9. Appium中长按按钮操作

    在一次项目中,appium要对某个按钮进行长按操作(大于2s),类似拍微信小视频,参考网上长按视频会报错 action1 = TouchActions(self.driver) el = self.d ...

  10. Oracle(四):锁

    v$lock:视图列出当前系统持有的或正在申请的所有锁的情况 v$locked_object:视图列出当前系统中哪些对象正被锁定 1).查询当前数据库锁的情况,以及导致锁的sql语句: Select ...