Ganglia監控Hadoop與HBase集群


摘要: 以下基於上篇Hadoop2.6與HBase1.0集群架構: http://lizhenliang.blog.51cto.com/7876557/1665130 http://lizhenliang.blog.51cto.com/7876557/1661354  Hadoop集群基本部署完成,接下來就需要有一個監控系統,能及時發現性能瓶頸,給故障排除提供有力依據。

以下環境搭建基於Hadoop2.6與HBase1.0集群架構

  Hadoop集群基本部署完成,接下來就需要有一個監控系統,能及時發現性能瓶頸,給故障排除提供有力依據。監控hadoop集群系統好用的比較少,自身感覺ambari比較好用,但不能監控已有的集群環境,挺悲催的。ganglia在網上看到原生支持Hadoop、Hbase性能監控,試用一段時間感覺還不錯,監控項比較全面,配置簡單,軟件包在epel網絡源中,使用yum安裝方便快捷。

  Ganglia是一個開源集群監控系統,主要用來監控系統性能,如:cpu、mem、硬盤利用率、I/O負載、網絡流量等。

Ganglia涉及到三個組件:

  gmetad:定期從gmond獲取數據,並將數據存儲到RRD存儲引擎中。

  gmond:被監控端代理程序,用於收集監控信息,並發送給gmetad。

  ganglia-web:WEB前端,RRD繪圖后通過PHP展示。

Ganglia集群監控系統部署:

   1.CentOS7 YUM源自帶epel網絡源,直接安裝(部署到Master上,盡量單獨放一台機器上)

1 yum install epel-release   
2 yum install ganglia-web ganglia-gmetad ganglia-gmond

  2.配置監控端(在HMaster0上配置)

  2.1 配置監控程序

1 vi /etc/ganglia/gmetad.conf   #修改以下兩項
2 data_source "Hadoop" 192.168.18.215 192.168.18.216 192.168.18.217 192.168.18.218192.168.18.219
3 case_sensitive_hostnames 1

  參數說明:

  第一個是數據源,Hadoop是集群名字,后跟IP是集群中被監控節點地址。

    第二個意思是是否區分主機名大小寫,默認是0,修改為1,否則節點中主機名有大寫的將保存為小寫,寫到/var/lib/ganglia/rrds/Hadoop中,導致圖形無數據。

  2.2 關聯Apache,因為Ganglia自創建的配置ganglia.conf有問題,所以先刪除,再創建個軟連接到Apache根目錄下。 

1 rm /etc/httpd/conf.d/ganglia.conf  
2 ln -s /usr/share/ganglia /var/www/html/ganglia

  2.3 啟動Apache和Ganglia,並設置開機啟動

1 service httpd start
2 service gmetad start
3 chkconfig httpd on
4 chkconfig gmetad on

  3. 安裝與配置被監控端(每台同樣配置)

  3.1 安裝與配置代理程序

 1 yum install ganglia-gmond
 2 vi /etc/ganglia/gmond.conf
 3  ……
 4  cluster{
 5    name = "Hadoop"              #集群名,和上面那個一樣
 6    owner = "unspecified"
 7    latlong = "unspecified"
 8    url = "unspecified"
 9  }
10    
11  /* Thehost section describes attributes of the host, like the location */
12  host {
13    location = "unspecified"
14  }
15    
16  /*Feel free to specify as many udp_send_channels as you like.  Gmond
17     used to only support having a single channel*/
18  udp_send_channel{
19    #bind_hostname = yes # Highly recommended,soon to be default.
20                        # This option tells gmond to use asource  address
21                         # that resolves to themachine's hostname.  Without
22                         # this, the metrics mayappear to come from any
23                         # interface and the DNSnames associated with
24                         # those IPs will be usedto create the RRDs.
25    #mcast_join = 239.2.11.71   #關閉多播
26    host = 192.168.18.215     #添加發送IP/主機名
27    port = 8649          #默認端口
28    ttl = 1
29  }
30   
31  /* Youcan specify as many udp_recv_channels as you like as well. */
32  udp_recv_channel{
33    #mcast_join = 239.2.11.71  
34    port = 8649
35    bind = 192.168.18.215      #接收地址
36    retry_bind = true
37    # Size of the UDP buffer. If you are handlinglots of metrics you really
38    # should bump it up to e.g. 10MB or evenhigher.
39    # buffer = 10485760
40  }
41  ……

  3.2 將修改好的gmond.conf配置scp到其他節點

1 scp /etc/ganglia/gmond.conf root@HMaster1:/etc/ganglia/gmond.conf   #分別拷貝HSlave0、12

  3.3 啟動代理程序,並設置開機啟動

1 service gmond start
2 chkconfig gmond on

  4.添加Hadoop被Ganglia監控,去掉文件中以***釋並修改(每台同樣配置)

 1 vi /opt/hadoop-2.6.0/etc/hadoop/hadoop-metrics2.properties
 2 *.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31
 3 *.sink.ganglia.period=10
 4 *.sink.ganglia.supportsparse=true
 5 *.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both
 6 *.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
 7 namenode.sink.ganglia.servers=192.168.18.215:8649    #當有多個ganglia監控系統時,以逗號分隔
 8 datanode.sink.ganglia.servers=192.168.18.215:8649     #都指定ganglia服務器
 9 resourcemanager.sink.ganglia.servers=192.168.18.215:8649
10 nodemanager.sink.ganglia.servers=192.168.18.215:8649

  5. 添加HBase被Ganglia監控,添加如下(每台同樣配置)

vi /opt/hbase-1.0.1.1/conf/hadoop-metrics2-hbase.properties
*.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31  
*.sink.ganglia.period=10  
hbase.sink.ganglia.period=10  
hbase.sink.ganglia.servers=192.168.18.215:8649

  6.重啟Hadoop和HBase

  7.通過WEB查看性能監控數據

  訪問的網址為: http://192.168.18.215/ganglia

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM