1. 程式人生 > >Flume安裝和配置

Flume安裝和配置

header ppc org inter deb type form 配置文件 close

Flume的官網

  http://flume.apache.org

Flume的部署

  1、JDK的安裝

  2、安裝包下載網址:apache-flume-1.5.0-bin.tar.gz

     源碼下載地址:apache-flume-1.5.0-src.tar.gz

  3、將壓縮包復制到系統中~/sw/目錄下,

    安裝包解壓:tar zxvf apache-flume-1.5.0-bin.tar.gz

    源碼解壓: tar zxvf apache-flume-1.5.0-src.tar.gz

    移動到~/md/   mv apache-flume-1.5.0-bin ../md/

    移動到~/md/  mv apache-flume-1.5.0-src ../md/

    將源碼復制到安裝bin目錄下

    技術分享圖片

  4、設置環境變量

    vi ~/.bash_profile

    export FLUME_HOME =/home/a/md/apache-flume-1.5.0-bin

    export PATH = $FLUME_HOME/bin:$PATH

    source ~/.bash_profile

  5、修改配置文件

   ~/md/apache-flume-1.5.0-bin 下查找flume-env.sh

    技術分享圖片

  6、驗證flume是否安裝完成

    技術分享圖片

  7、Flume的測試

     ~/md/apache-flume-1.5.0-bin/conf 創建agent1.conf

      

    agent1.sources = source1
    agent1.channels = channel1
    agent1.sinks = sink1

    # For each one of the sources, the type is defined
    agent1.sources.source1.type = spooldir
    agent1.sources.source1.spoolDir =/home/a/flume/aboutyunlog

    # The channel can be defined as follows.
    agent1.source1.source1.channels=channel1
    agent1.source1.source1.fileHeader=false


    # Each sink‘s type must be defined
    agent1.sinks.sink1.type=hdfs
    agent1.sinks.sink1.hdfs.path=hdfs://master:9000/flume/aboutyunlog
    agent1.sinks.sink1.hdfs.fileType=DataStream
    agent1.sinks.sink1.writeFormat=TEXT
    agent1.sinks.sink1.hdfs.rollInterval=60


    #Specify the channel the sink should use
    agent1.sinks.sink1.channel=channel1


    # Each channel‘s type is defined.
    agent1.channels.channel1.type=file
    agent1.channels.channel1.checkpointDir=/home/a/flume/aboutyun_check
    agent1.channels.channel1.dataDirs=/home/a/flume/aboutyun_data

    $FLUME_HOME下編寫shell腳本文件

    

    #!bin/bash
    bin/flume-ng agent -n agent1 -c conf -f conf/agent1.conf -Dflume.root.logger=DEBUG,console >./agent1.log 2>&1 &

    如果HDFS啟動的話,在當前目錄下

    bash agent1.bash

    jps查看進程是否有進程名稱叫做Appcation的

    如果想查看相關實時內容可以 Tail -f agent.log進行查看

    cd ~/flume/aboutyunlong

    echo fafsdfsafsa>> 1.txt

    echo ffasfasfsaf>> 2.txt

    ls 查看目錄下是否包含1.txt.COMPELTED, 2.txt.COMPELTED.

    再去HDFS上面查看數據

    hdfs dfs -ls /flume/aboutyunlog

    hdfs dfs -cat /flume/aboutyunlog/*

    完結,暫時寫的這裏,有不對的地方請指正。

  

Flume安裝和配置