ganglia監控hadoop 容器節點

hadoop容器運行參考上篇博客 http://blog.csdn.net/wenwenxiong/article/details/78973755
參看網址: https://gist.github.com/ameizi/0c77e3dbb13ded779347

在namenode容器節點上安裝ganglia-webfrontend和ganglia-monitor

sudo apt-get update
sudo apt-get install ganglia-webfrontend ganglia-monitor

在主節點上安裝ganglia-webfrontend和ganglia-monitor。在其他監視節點上,只需要安裝ganglia-monitor即可

將ganglia的文件鏈接到apache的默認目錄下

sudo ln -s /usr/share/ganglia-webfrontend /var/www/html/ganglia

在datanode1容器節點安裝ganglia-monitor

在其他監視節點上,只需要安裝ganglia-monitor

sudo apt-get install ganglia-monitor

Ganglia配置

gmond.conf

在每個節點上都需要配置/etc/ganglia/gmond.conf,配置相同如下所示

sudo vim /etc/ganglia/gmond.conf

修改後的/etc/ganglia/gmond.conf

globals {                    
  daemonize = yes  ##以後臺的方式運行            
  setuid = yes             
  user = ganglia     #運行Ganglia的用戶              
  debug_level = 0               
  max_udp_msg_len = 1472        
  mute = no             
  deaf = no             
  host_dmax = 0 /*secs */ 
  cleanup_threshold = 300 /*secs */ 
  gexec = no             
  send_metadata_interval = 10     #發送數據的時間間隔
} 

/* If a cluster attribute is specified, then all gmond hosts are wrapped inside 
 * of a <CLUSTER> tag.  If you do not specify a cluster tag, then all <HOSTS> will 
 * NOT be wrapped inside of a <CLUSTER> tag. */ 
cluster { 
  name = "test"         #集羣名稱
  owner = "ganglia"               #運行Ganglia的用戶
  latlong = "unspecified" 
  url = "unspecified" 
} 

/* The host section describes attributes of the host, like the location */ 
host { 
  location = "unspecified" 
} 

/* Feel free to specify as many udp_send_channels as you like.  Gmond 
   used to only support having a single channel */ 
udp_send_channel { 
  #mcast_join = 239.2.11.71     #註釋掉組播
  host = namenode                 #發送給安裝gmetad的機器
  port = 8649                   #監聽端口
  ttl = 1 
} 

/* You can specify as many udp_recv_channels as you like as well. */ 
udp_recv_channel { 
  #mcast_join = 239.2.11.71     #註釋掉組播
  port = 8649 
  #bind = 239.2.11.71 
} 

/* You can specify as many tcp_accept_channels as you like to share 
   an xml description of the state of the cluster */ 
tcp_accept_channel { 
  port = 8649 
} 

gmetad.conf

在主節點上還需要配置/etc/ganglia/gmetad.conf,這裏面的名字hadoop-cluster和上面gmond.conf中name應該一致。 

/etc/ganglia/gmetad.conf

sudo vim /etc/ganglia/gmetad.conf

修改爲以下內容

data_source "test" 10 namenode:8649 datanode1:8649
setuid_username "nobody"
rrd_rootdir "/var/lib/ganglia/rrds"
gridname "test"

注:namenode:8649 datanode1:8649爲要監聽的主機和端口,data_source中test與gmond.conf中name一致

啓動Ganglia

在各個節點上啓動gmond服務,主節點還需要啓動gmetad服務。

使用apt-get方式安裝的Ganglia,可以直接用service方式啓動。

sudo service ganglia-monitor start(每臺機器都需要啓動)

sudo service gmetad start(在安裝了ganglia-webfrontend的機器上啓動)

檢驗

登錄瀏覽器查看:http://namenode/ganglia,如果Hosts up爲9即表示安裝成功。
若出現url無法訪問
確保apache2服務運行:service apache2 start 或/etc/init.d/apache2 start

若安裝不成功,有幾個很有用的調試命令:

以調試模式啓動gmetad:gmetad -d 9
查看gmetad收集到的XML文件:telnet master 8649

ganglia主頁面
hadoop-test
共6個節點,選擇namenode節點查看
namenode
選擇datanode1節點查看
datanode1

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