flume的安装

好久没有更新大数据的一些东西了,今天记录一些自己的flume的安装过程,当然我的所有环境还是都安装在/opt/下的

    flume的安装:

        (1)下载

        wget http://mirrors.tuna.tsinghua.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


        修改配置文件:

        cd conf
        cp flume-env.sh.template flume-env.sh
        cp flume-conf.properties.template flume-conf.properties 
        vim flume-env.sh


        加入下面这句(也就是你的java环境安装路径):

        export JAVA_HOME=/usr/lib/jdk/jdk1.8.0_25

        查看是否安装成功:

        apache-flume-1.7.0-bin/bin/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

       
        即为安装成功
        


        (2)测试Telnet    source源
    
        首先安装telent服务(假如没有的话)
        apt install telnet-*
        
        然后配置一份源文件,用来测试telent服务:


        vi conf/flume-conf.properties
        
        # 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 = 10.1.18.201
        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/flume-conf.properties --name a1 -Dflume.root.logger=INFO,console

    
        然后打开另一个客户端,使用talnet给flume发送一个event

        telnet localhost 44444

      在新开的客户端发送消息即可
        若出现响应即为成功
    
        (3)使用avro引入source源
        
        新创建一个文件
    
        touch conf/avro.conf
    


        vim avro.conf
        
        a1.sources = r1
        a1.sinks = k1
        a1.channels = c1
        
        # Describe/configure the source
        a1.sources.r1.type = avro
        a1.sources.r1.channels = c1
        a1.sources.r1.bind = 0.0.0.0
        a1.sources.r1.port = 4141
        
        # 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

    
        然后在apache-flume-1.8.0-bin主目录下新建一文件,作为输入:

        touch log.00
        echo "hello world!" >> log.00


        启动flume agent:

./bin/flume-ng agent agent -c conf -f ./conf/avro.conf -n a1 -Dflume.root.logger=INFO,console

          在另一台客户端上利用avro-client 发送文件:

        ./bin/flume-ng avro-client -H 10.1.18.201 -p 4141 -F ./log.00

        出现正常输出即为安装成功

另外还有其他的源的测试,还没放上,在后面的文章中会放上的

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yann.bai

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值