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 ...
随机推荐
- 关于MCU的烧录,下载与其他接口的比较(一)
今天呢,犯了一个很严重的错误,我不知道这会产生什么样的影响,但我知道,如果我以后再没有具体的了解,仔细认真地观察,认证,只会滑到无底的深渊.做技术来不得半点虚假,切记一知半解,凡事都要弄得清楚明白,认 ...
- 关于Ethread的一些研究
环境 win764 以TP为例 ring3保护 它会在windbg断下 这个时候我们需要拿到当前线程对象 应该到 当前使用的CPU的地址 _KPRCB-> CurrentThread 就是当前线 ...
- JS 添加js节点
function AddScriptNode(src) { var N = document.createElement("script"); N.setAttribute(&qu ...
- 【golang】 go语言之环境搭建+ 第一个go语言程序
1 下载:http://www.golangtc.com/download (以win为例) 2 安装步骤: 安装包: go1.8.windows-amd64.msi 双击进行安装 创建工作目录 :D ...
- linux如何设置用户权限
linux与用户权限设置: 1.添加用户 首先用adduser命令添加一个普通用户,命令如下: #adduser tommy //添加一个名为tommy的用户 #passwd tommy //修改密码 ...
- Weinre 远程调试移动端手机web页面
调试场景 1.调试页面在手机上.2.调试工具在PC的chrome3.手机跟pc要在同一个网络环境下,也就是都使用一个wifi 一.安装 Weinre 1.Weinre是基于nodejs实现的,所以使用 ...
- Egret Wing4.0.3 合并资源图片问题
一 发布项目时,选择合并图片资源 选择合图大小 发布后,图片合并.随机了图片名字. 二 随机名的问题 当资源不变更的情况下,多次发布,每次发布后资源的图片随机名是不变的. 现在改变preload组 ...
- 移动端开发--rem和像素如何使用!
刚开始做移动端的开发的时候,大多时候是在使用 像素(PX)来写页面和布局的,但是使用下来,还是有多少不好用! 随之就开始用 rem 来写,rem写的结果是页面放到一些屏幕上,字体过小,如果页面渲染用了 ...
- 从零搭建 vue-cli 脚手架
前言: 用了几次 vue-cli 做 vue 项目,感觉没什么大问题,虽然也没有用 vue-router 和 vuex .但是心里一直有个梗,就是最初的目录生成和配置文件,一直没动过,也不知道具体原理 ...
- 170503、centos6.5安装mysql5.6.30
准备:虚拟机地址:192.168.0.110 安装目录/usr/local/ 首先卸载已经安装的mysql使用命令查看rpm -qa | grep mysql卸载使用 rpm -e xxx 或者 yu ...