当前位置: 首页 > news >正文

flume单机版安装

1、安装jdk(提前安装准备)
[root@keep-hadoop ~]# java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
2、下载安装包

https://archive.apache.org/dist/flume/

3、解压安装包到指定目录
[root@keep-hadoop ~]# tar -zxvf apache-flume-1.6.0-bin.tar.gz -C /usr/local/src
4、配置环境变量
[root@cenots ~]# vim /etc/profile
export FLUME_HOME=/usr/local/src/apache-flume-1.6.0-bin
export PATH=$PATH:$FLUME_HOME/bin
export FLUME_CONF_DIR=$FLUME_HOME/conf[root@cenots ~]# source /etc/profile
5、检查环境
[root@keep-hadoop apache-flume-1.6.0-bin]# flume-ng version
Flume 1.6.0
Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git
Revision: 2561a23240a71ba20bf288c7c2cda88f443c2080
Compiled by hshreedharan on Mon May 11 11:15:44 PDT 2015
From source with checksum b29e416802ce9ece3269d34233baf43f
6、修改Flume配置

# NetCat模式

[root@keep-hadoop apache-flume-1.6.0-bin]# vim conf/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 = keep-hadoop
agent.sources.r1.port = 44444# 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 = 1000
agent.channels.c1.transactionCapacity = 100# Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

# 验证

# Server

[root@keep-hadoop ~]# bin/flume-ng agent --conf conf --conf-file conf/flume-netcat.conf --name=agent -D flume.root.logger=INFO,console

# Client

[root@keep-hadoop ~]# telnet keep-hadoop 44444

# 查看日志

[root@keep-hadoop apache-flume-1.6.0-bin]# tail -f logs/flume.log

# Exec模式

[root@keep-hadoop apache-flume-1.6.0-bin]# vim conf/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 /usr/local/src/apache-flume-1.6.0-bin/test.txt# 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 = 1000
agent.channels.c1.transactionCapacity = 100# Bind the source and sink to the channel
agent.sources.r1.channels = c1
agent.sinks.k1.channel = c1

# Server

[root@keep-hadoop apache-flume-1.6.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/flume-exec.conf --name=agent -D flume.root.logger=INFO,console

# Client

[root@keep-hadoop apache-flume-1.6.0-bin]# while true;do echo `date` >> /usr/local/src/apache-flume-1.6.0-bin/test.txt ; sleep 1; done

# 查看日志

[root@keep-hadoop apache-flume-1.6.0-bin]# tail -f logs/flume.log

# Avro模式

# 这里是avro格式,telnet不能做转换
[root@keep-hadoop apache-flume-1.6.0-bin]# vim conf/flume-avro.conf
# Define a memory channel called c1 on agent
agent.channels.c1.type = memory# Define an avro source alled r1 on agent and  tell it
agent.sources.r1.channels = c1
agent.sources.r1.type = avro
agent.sources.r1.bind = keep-hadoop
agent.sources.r1.port = 44444# Describe/configuration the source
agent.sinks.k1.type = hdfs
agent.sinks.k1.channel = c1
agent.sinks.k1.hdfs.path = hdfs://keep-hadoop:9000/flume_data_pool
agent.sinks.k1.hdfs.filePrefix = events-
agent.sinks.k1.hdfs.fileType = DataStream
agent.sinks.k1.hdfs.writeFormat = Text
agent.sinks.k1.hdfs.rollSize = 0
agent.sinks.k1.hdfs.rollCount= 600000
agent.sinks.k1.hdfs.rollInterval = 600agent.channels = c1
agent.sources = r1
agent.sinks = k1

# 验证

# Server

[root@keep-hadoop apache-flume-1.6.0-bin]# bin/flume-ng agent --conf conf --conf-file conf/flume-avro.conf --name=agent -Dflume.root.logger=DEBUG,console

# Client

[root@keep-hadoop apache-flume-1.6.0-bin]# cat helloworld.txt
test1[root@keep-hadoop apache-flume-1.6.0-bin]# bin/flume-ng avro-client --host keep-hadoop --port 44444 -F ./helloworld.txt

http://www.dtcms.com/a/617906.html

相关文章:

  • C++篇(17)哈希拓展学习
  • 做建筑材料的网站wordpress后台左侧菜单显示
  • 基于SpringBoot的热门旅游推荐系统设计与实现
  • leetcode 1513 仅含1的子串数
  • 2014网站怎么备案网站怎么做口碑
  • 【微服务】SpringBoot 整合高性能时序数据库 Apache IoTDB 实战操作详解
  • 【电路笔记】-单稳态多谐振荡器
  • Java数据结构-Map和Set-通配符?-反射-枚举-Lambda
  • 在那里能找到网站网络营销与网站推广的区别
  • 架构之路(六):把框架拉出来
  • 【Linux驱动开发】Linux SPI 通信详解:从硬件到驱动再到应用
  • 【ASP.NET进阶】Controller层核心:Action方法全解析,从基础到避坑
  • Imec实现了GaN击穿电压的记录
  • Streaming ELT with Flink CDC · Iceberg Sink
  • AI(新手)
  • 海南城乡建设厅网站百度竞价关键词查询
  • QT开发——常用控件(2)
  • 【Java架构师体系课 | MySQL篇】⑥ 索引优化实战二
  • Spring Boot、Redis、RabbitMQ 在项目中的核心作用详解
  • 做完整的网站设计需要的技术长治建立公司网站的步骤
  • 南宁京象建站公司网站建设留言板实验心得
  • AI、LLM全景图
  • pip升级已安装包方法详解
  • 【Linux日新月异(六)】CentOS 7网络命令深度解析:从传统到现代网络管理
  • LangChain 构建 AI 代理(Agent)
  • 人工智能训练师备考——3.1.1题解
  • 【RL】ORPO: Monolithic Preference Optimization without Reference Model
  • 公益平台网站怎么做网站跳出
  • QT的5种标准对话框
  • 用Rust构建一个OCR命令行工具