Flume安裝和簡單測試

下載地址

http://archive.apache.org/dist/flume/1.6.0/

系統要求

Java運行時環境 - Java 1.8或更高版本

內存 - 源,通道或接收器使用的配置的足夠內存

磁盤空間 - 通道或接收器使用的配置的足夠磁盤空間

目錄權限 - 代理使用的目錄的讀/寫權限

=================================================================================

flume環境搭建

       上傳flume二進制包到集羣

       cp apache-flume-1.6.0-bin.tar.gz soft/

       解壓:tar -zxvf /home/hyxy/soft/apache-flume-1.6.0-bin.tar.gz

       創建軟連接:ln -s apache-flume-1.6.0-bin flume

       配置環境變量:vim ~/.bashrc

                加入

                export FLUME_HOME=/home/hyxy/soft/flume

                將flume加入到path裏面

                 export PATH=$FLUME_HOME/bin:$SPARK_HOME/bin:.....

       驗證成功:flume-ng version

打印以下信息

Flume 1.6.0

Source code repository: https://git-wip-us.apache.org/repos/asf/flume.git

Revision: 2561a23240a71ba20bf288c7c2cda88f443c2080

Compiled by hshreedharan on Mon May 11 11:15:44 PDT 2015

From source with checksum b29e416802ce9ece3269d34233baf43f

==========================================================================================

安裝nc(netcat)

     sudo yum install -y nc

     測試nc

     開啓一個服務:  nc -l 10000

     打開另一個終端:nc localhost 10000

                輸入nihao

                服務端接受到 OK

============================================================================================

案例:接收nc發送的消息然後顯示在控制檯

配置配置文件(文件名隨便)

cp flume-conf.properties.template example.conf

vim example.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

啓動flume-ng(注意=左右沒有空格)

格式:flume-ng agent --conf 【conf目錄】 --conf-file 【要運行的conf文件】 --name agent -Dflume.root.logger=INFO,console

例:flume-ng agent --conf /home/hyxy/soft/flume/conf/ --conf-file example.conf --name agent -Dflume.root.logger=INFO,console

啓動nc

nc localhost 44444

發送消息

隨便

接受到消息(成功)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章