下载解压到/usr/local/flume
配置环境变量
export FLUME_HOME=/usr/local/flume export FLUME_CONF_DIR=$FLUME_HOME/conf export PATH=.:$PATH::$FLUME_HOME/bin
在conf里配置flume-env.sh 添加jdk路径
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
flume-ng version
验证是否安装成功
[email protected]:~# flume-ng version Flume 1.7.0 Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git Revision: 511d868555dd4d16e6ce4fedc72c2d1454546707 Compiled by bessbd on Wed Oct 12 20:51:10 CEST 2016 From source with checksum 0d21b3ffdc55a07e1d08875872c00523
ps:如果报这错java.lang.ClassNotFoundException: org.apache.flume.tools.GetJavaProperty
就将hbase的hbase.env.sh的一行配置注释掉
#export HBASE_CLASSPATH=/xxx
在conf里创建single-node.conf
# example.conf: A single-node Flume configuration # Name the components on this agent a1.sources = r1 a1.sinks = k1 a1.channels = c1 # Describe/configure the source a1.sources.r1.type = netcat a1.sources.r1.bind = localhost a1.sources.r1.port = 44444 # Describe the sink a1.sinks.k1.type = logger # Use a channel which buffers events in memory a1.channels.c1.type = memory a1.channels.c1.capacity = 1000 a1.channels.c1.transactionCapacity = 100 # Bind the source and sink to the channel a1.sources.r1.channels = c1 a1.sinks.k1.channel = c1
运行
bin/flume-ng agent --conf conf --conf-file conf/single-node.conf --name a1 -Dflume.root.logger=INFO,console
另外打开一个终端
telnet 127.0.0.1 44444
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is ‘^]‘.
然后在这边随便输入内容,再去原来的终端观察
时间: 2024-10-07 11:57:02