Ganglia和Flume1.7安裝與部署

一、flume安裝

[woek@hadoop1 software]$ tar -zxf apache-flume-1.7.0-bin.tar.gz -C /opt/module/
[woek@hadoop1 module]$ mv apache-flume-1.7.0-bin flume
[woek@hadoop1 conf]$ mv flume-env.sh.template flume-env.sh
[woek@hadoop1 conf]$ vi flume-env.sh
# 更改JAVA_HOME
export JAVA_HOME=/opt/module/jdk

二、Ganglia安裝和部署

1.安裝阿里云yum源

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

image.png

2.安裝httpd服務(wù)與php

sudo yum -y install httpd php

3.安裝其他依賴

sudo yum -y install rrdtool perl-rrdtool rrdtool-devel

sudo yum -y install apr-devel

4.安裝ganglia

sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

sudo yum -y install ganglia-gmetad

sudo yum -y install ganglia-gmetad

sudo yum install -y ganglia-gmond

  • Ganglia由gmond、gmetad和gweb三部分組成

gmond(Ganglia Monitoring Daemon)是一種輕量級服務(wù),安裝在每臺需要收集指標(biāo)數(shù)據(jù)的節(jié)點(diǎn)主機(jī)上。使用gmond,你可以很容易收集很多系統(tǒng)指標(biāo)數(shù)據(jù),如CPU、內(nèi)存、磁盤、網(wǎng)絡(luò)和活躍進(jìn)程的數(shù)據(jù)等。
gmetad(Ganglia Meta Daemon)整合所有信息,并將其以RRD格式存儲至磁盤的服務(wù)。
gweb(Ganglia Web)Ganglia可視化工具,gweb是一種利用瀏覽器顯示gmetad所存儲數(shù)據(jù)的PHP前端。在Web界面中以圖表方式展現(xiàn)集群的運(yùn)行狀態(tài)下收集的多種不同指標(biāo)數(shù)據(jù)。

5.修改配置文件ganglia.conf

sudo vim /etc/httpd/conf.d/ganglia.conf

#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
  Order deny,allow
  #Deny from all
  Allow from all
  # Allow from 127.0.0.1
  # Allow from ::1
  # Allow from .example.com
</Location>

6. 修改配置文件/etc/ganglia/gmetad.conf

sudo vim /etc/ganglia/gmetad.conf

data_source "hadoop1" 192.168.111.111

7.修改配置文件/etc/ganglia/gmond.conf

sudo vim /etc/ganglia/gmond.conf

cluster {
  name = "hadoop1"
  # mcast_join = 239.2.11.71
  host = 192.168.1111.111
  # mcast_join = 239.2.11.71
  bind = 192.168.1111.111
}

8. 修改配置文件/etc/selinux/config

sudo vim /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
  • selinux本次生效關(guān)閉必須重啟,如果此時(shí)不想重啟,可以臨時(shí)生效之

sudo setenforce 0

9.啟動(dòng)ganglia

sudo service httpd start
sudo service gmetad start
sudo service gmond start

10.打開網(wǎng)頁瀏覽ganglia頁面

http://192.168.111.111/ganglia

  • 如果完成以上操作依然出現(xiàn)權(quán)限不足錯(cuò)誤,請修改/var/lib/ganglia目錄的權(quán)限:
    sudo chmod -R 777 /var/lib/ganglia

11.操作Flume測試監(jiān)控

11.1修改/opt/module/flume/conf目錄下的flume-env.sh配置:

JAVA_OPTS="-Dflume.monitoring.type=ganglia
-Dflume.monitoring.hosts=192.168.111.111:8649
-Xms100m
-Xmx200m"

11.2創(chuàng)建Flume Agent配置文件flume-netcat-logger.conf

[woek@hadoop1 flume]$  mkdir job
[woek@hadoop1 flume]$  cd job/
[woek@hadoop1 flume]$  touch flume-netcat-logger.conf
[woek@hadoop1 flume]$  vim flume-netcat-logger.conf
# 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

11.3啟動(dòng)Flume任務(wù)

 bin/flume-ng agent \
--conf conf/ \
--name a1 \
--conf-file job/flume-netcat-logger.conf \
-Dflume.root.logger==INFO,console \
-Dflume.monitoring.type=ganglia \
-Dflume.monitoring.hosts=192.168.111.111:8649

11.4發(fā)送數(shù)據(jù)觀察ganglia監(jiān)測圖

nc localhost 44444

Ganglia監(jiān)控
  • 監(jiān)控名詞解析
字段(圖表名稱) 字段含義
EventPutAttemptCount source嘗試寫入channel的事件總數(shù)量
EventPutSuccessCount 成功寫入channel且提交的事件總數(shù)量
EventTakeAttemptCount sink嘗試從channel拉取事件的總數(shù)量。這不意味著每次事件都被返回,因?yàn)閟ink拉取的時(shí)候channel可能沒有任何數(shù)據(jù)。
EventTakeSuccessCount sink成功讀取的事件的總數(shù)量
StartTime channel啟動(dòng)的時(shí)間(毫秒)
StopTime channel停止的時(shí)間(毫秒)
ChannelSize 目前channel中事件的總數(shù)量
ChannelFillPercentage channel占用百分比
ChannelCapacity channel的容量
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

友情鏈接更多精彩內(nèi)容