flume1.6.0 linux 安裝與監控
阿新 • • 發佈:2019-02-08
下載
apache-flume-1.6.0-bin.tar.gz
解壓
tar -zxvf apache-flume-1.6.0-bin.tar.gz
配置
cp conf/flume-conf.properties.template conf/flume-conf.properties//配置的模板(source,sink,channel)
cp conf/flume-env.sh.template conf/flume-env.sh//環境配置的模板(jdk,flume路徑之類的)
vi flume-env.sh增加以下配置
export JAVA_HOME=/usr/java/jdk1.8 .0_121
FLUME_CLASSPATH=/opt/flume-1.6.0/lib
單機配置
在conf目錄下建立single-node.conf(模仿flume-conf.properties.template)檔案,並將下面內容複製貼上
# 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
執行
bin/flume-ng agent --conf conf --conf-file conf/single-node.conf --name a1 -Dflume.root.logger=INFO,console
(1)Http監控
使用這種監控方式,只需要在啟動flume的時候在啟動引數上面加上監控配置,例如這樣:
bin/flume-ng agent -c conf/ -f conf/single-node.conf -n a1 -Dflume.monitoring.type=http -Dflume.monitoring.port=5653
其中-Dflume.monitoring.type=http表示使用http方式來監控,後面的-Dflume.monitoring.port=5653表示我們需要啟動的監控服務的埠號為5653,這個埠號可以自己隨意配置。然後啟動flume之後,通過https://ip:5653/metrics就可以得到flume的一個json格式的監控資料。