Flume环境安装
源码包下载:
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环境安装的更多相关文章
- Flume1 初识Flume和虚拟机搭建Flume环境
前言: 工作中需要同步日志到hdfs,以前是找运维用rsync做同步,现在一般是用flume同步数据到hdfs.以前为了工作简单看个flume的一些东西,今天下午有时间自己利用虚拟机搭建了 ...
- 日志采集框架Flume以及Flume的安装部署(一个分布式、可靠、和高可用的海量日志采集、聚合和传输的系统)
Flume支持众多的source和sink类型,详细手册可参考官方文档,更多source和sink组件 http://flume.apache.org/FlumeUserGuide.html Flum ...
- Flume环境搭建_五种案例
Flume环境搭建_五种案例 http://flume.apache.org/FlumeUserGuide.html A simple example Here, we give an example ...
- 日志收集框架flume的安装及简单使用
flume介绍 Flume是一个分布式.可靠.和高可用的海量日志采集.聚合和传输的系统. Flume可以采集文件,socket数据包等各种形式源数据,又可以将采集到的数据输出到HDFS.hbase.h ...
- Flume环境搭建_五种案例(转)
Flume环境搭建_五种案例 http://flume.apache.org/FlumeUserGuide.html A simple example Here, we give an example ...
- 02_ Flume的安装部署及其简单使用
一.Flume的安装部署: Flume的安装非常简单,只需要解压即可,当然,前提是已有hadoop环境 安装包的下载地址为:http://www-us.apache.org/dist/flume/1. ...
- Flume介绍安装使用
APache Flume官网:http://flume.apache.org/releases/content/1.9.0/FlumeUserGuide.html#memory-channel 目录 ...
- Flume 组件安装配置
下载和解压 Flume 实验环境可能需要回至第四,五,六章(hadoop和hive),否则后面传输数据可能报错(猜测)! 可 以 从 官 网 下 载 Flume 组 件 安 装 包 , 下 载 地 址 ...
- 使用专业的消息队列产品rabbitmq之centos7环境安装
我们在项目开发的时候都不可避免的会有异步化的问题,比较好的解决方案就是使用消息队列,可供选择的队列产品也有很多,比如轻量级的redis, 当然还有重量级的专业产品rabbitmq,rabbitmq ...
随机推荐
- leetcode -- permutation 总结
leetcode上关于permutation有如下几题 Permutation Sequence Next Permutation Permutations Permutations II
- redis安装之zmalloc.h:55:2: error: #error "Newer version of jemalloc required"错误
redis是C语言编写的软件,安装前需要编译,需要gcc编译环境,确认安装gcc编译环境后(安装gcc命令:yum install gcc-c++) 在redis解压目录下,确认有Makefile文件 ...
- WebSphere和IHS的安装
环境:CentOS6.5, IP :192.168.0.91 hostname: IHS 1.下载Installation Manage安装包 URL:http://www.ibm.com/devel ...
- java生成webservice方法
参考: https://note.youdao.com/ynoteshare1/index.html?id=c10324bb3b794baece3d2ae9faadc5c1&type=note
- MUI 单个图片上传预览(拍照+系统相册):先选择->预览->上传提交
1 html部分 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...
- Eclipse '<>' operator is not allowed for source level below 1.7
'<>' operator is not allowed for source level below 1.7 解决方法:
- EUI Scroller实现自定义图片轮播 组件ScrollView
一 自定义组件如下 /** * 文 件 ScrollView.ts * 功 能: 滚动组件 * 内 容: 自定义组件,支持多张图片水平(垂直)切换滚动 * * Example: * 1. 从自定义组件 ...
- java使用poi解析或处理excel的时候,如何防止数字变成科学计数法的形式和其他常见Excel中数据转换问题
当使用POI处理excel的时候,遇到了比较长的数字,虽然excel里面设置该单元格是文本类型的,但是POI的cell的类型就会变成数字类型. 而且无论数字是否小数,使用cell.getNumberi ...
- Lucene.net之解决锁的问题
public sealed class SearchIndexManager { private static readonly SearchIndexManager searchManager=ne ...
- Windows使用filezilla搭建FTP服务器
参考:https://segmentfault.com/a/1190000009033181 下载软件https://filezilla-project.org/ 安装过程不详述,默认安装即可 启动软 ...