flume安装及简单的配置

  • 首先我们要准备flume的安装包,这里我们安装的flume版本是apache-flume-1.6.0-bin.tar.gz

    flume的运行环境是基于java环境下运行的,所以在安装flume之前我么你要先安装java环境

  • 安装好java环境并测试成功后,我们开始安装flume
    1、flume安装包放在/usr/flume,先解压安装包,解压了就可以了,不用再去安装啦

    tar -zxvf apache-flume-1.6.0-bin.tar.gz 

    这里写图片描述
    2、配置环境变量

    vi /etc/profile
    
    在最后添加以下内容:
    export FLUME_HOME=/usr/flume/apache-flume-1.6.0-bin
    export FLUME_CONF_DIR=$FLUME_HOME/conf
    export PATH=$PATH:$FLUME_HOME/bin

    这里写图片描述

    source /etc/profile#使配置生效
    echo $PATH #查看环境变量

    echo $PATH #查看环境变量
    3、配置flume的基本配置(引入java环境)
    (1):修改usr/flume/apache-flume-1.6.0-bin/conf/flume-env.sh.template

    
    # Licensed to the Apache Software Foundation (ASF) under one
    
    
    # or more contributor license agreements.  See the NOTICE file
    
    
    # distributed with this work for additional information
    
    
    # regarding copyright ownership.  The ASF licenses this file
    
    
    # to you under the Apache License, Version 2.0 (the
    
    
    # "License"); you may not use this file except in compliance
    
    
    # with the License.  You may obtain a copy of the License at
    
    #
    
    #     http://www.apache.org/licenses/LICENSE-2.0
    
    #
    
    # Unless required by applicable law or agreed to in writing, software
    
    
    # distributed under the License is distributed on an "AS IS" BASIS,
    
    
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    
    
    # See the License for the specific language governing permissions and
    
    
    # limitations under the License.
    
    
    # If this file is placed at FLUME_CONF_DIR/flume-env.sh, it will be sourced
    
    
    # during Flume startup.
    
    
    # Enviroment variables can be set here.
    
    export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64/jre
    
    # Give Flume more memory and pre-allocate, enable remote monitoring via JMX
    
    export JAVA_OPTS="-Xms100m -Xmx2000m -Dcom.sun.management.jmxremote"
    
    # Note that the Flume conf directory is always included in the classpath.
    
    
    #FLUME_CLASSPATH=""
    

    (2)新建一个test.conf配置flume的source,实现简单的小例子,放在conf文件夹里面
    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

    启动flume:/usr/flume/apache-flume-1.6.0-bin/bin/flume-ng agent --conf /usr/flume/apache-flume-1.6.0-bin/conf/ --conf-file /usr/flume/apache-flume-1.6.0-bin/conf/test.conf --name a1 -Dflume.root.logger=INFO,console

    如图表示flume启动成功
    这里写图片描述
    (3)再打开一个终端:

    telnet localhost 44444

    这里写图片描述
    如果提示无法识别telnet

     yum install telnet

    发送
    这里写图片描述
    结果
    这里写图片描述

总结:到这里flume的安装配置,以及最简单的实例已经介绍完毕,这只是flume众多手机source中的一种,下面会一一举例。(flume集中简单的实例

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值