centos7.4安装flume

1、查看java是否安装,没安装的安装,这里java已经安装不在进行安装
2、查看java的安装路径(根据自己的个人情况)
3、设置java环境变量
vi /etc/profile
在文件末尾加上下面两行 :注意JAVA_HOME为java的安装路径,根据自己实际情况填写
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk- 1.8.0.181-3.b13.el7_5.x86_64/jre
export PATH= J A V A H O M E / b i n : JAVA_HOME/bin: JAVAHOME/bin:JRE_HOME/bin:$PATH

source /etc/profile
然后用命令echo $JAVA_HOME 查看是否source 成功

4、安装flume
wget http://mirrors.hust.edu.cn/apache/flume/1.7.0/apache-flume-1.7.0-bin.tar.gz
tar -zxvf apache-flume-1.7.0-bin.tar.gz
mv apache-flume-1.7.0-bin /usr/local/flume-1.7.0

修改配置
cd /usr/local/flume-1.7.0/conf
cp flume-conf.properties.template flume-conf.properties
vi flume-conf.properties 具体配置如下

The configuration file needs to define the sources,

the channels and the sinks.

Sources, channels and sinks are defined per agent,

in this case called ‘agent’

agent.sources = r1
agent.channels = c1
agent.sinks = s1

For each one of the sources, the type is defined

agent.sources.r1.type = netcat
agent.sources.r1.bind = localhost
agent.sources.r1.port = 8888

The channel can be defined as follows.

agent.sources.r1.channels = c1

Each sink’s type must be defined

agent.sinks.s1.type = file_roll
agent.sinks.s1.sink.directory = /tmp/log/flume

#Specify the channel the sink should use
agent.sinks.s1.channel = c1

Each channel’s type is defined.

agent.channels.c1.type = memory

Other config values specific to each type of channel(sink or source)

can be defined as well

In this case, it specifies the capacity of the memory channel

agent.channels.c1.capacity = 100

功能验证
1.建立输出目录

mkdir -p /tmp/log/flume
2.启动服务

bin/flume-ng agent --conf conf -f conf/flume-conf.properties -n agent&
运行日志位于logs目录,或者启动时添加-Dflume.root.logger=INFO,console 选项前台启动,输出打印日志,查看具体运行日志,服务异常时查原因。

3.发送数据
另开启一个终端,输入如下内容
telnet localhost 8888
输入
test
然后回车
centos7.4安装flume_第1张图片
4、查看日志,判断flume是否安装成功
cd /tmp/log/flume
ls -al 查看日志的大小不为0的
vi 相关日志既为你输入的内容
这里为test
centos7.4安装flume_第2张图片

注意centos7.4版本没有自带telnet
1、telnet安装
yum install telnet-server.x86_64 -y
yum install telnet.x86_64 -y

2、 可搜索遍看是否已经写入环境中。
rpm -qa | grep telnet
出现以下两行,说明安装成功
telnet-0.17-47.el6.x86_64
telnet-server-0.17-47.el6.x86_64

3、yum install xinetd.x86_64 将xinetd 服务安装到系统中

4、 [更改配置文件,将telnet服务设置为默认启动,非必须]
cd /etc/xinetd.d
vi telnet

default: on

description: The telnet server serves telnet sessions; it uses \

unencrypted username/password pairs for authentication.

service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
5、开启telnet服务
service xinetd restart
6、查看状态
service xinetd status
running

参考博客
https://blog.csdn.net/wfh6732/article/details/55062016/
https://www.cnblogs.com/rwxwsblog/p/5800300.html

配置感想:
配置文件和log是法宝

你可能感兴趣的:(flume安装)