Ganglia的配置,用于监测系统和Hadoop性能
一、 介紹
Ganglia 監(jiān)控套件包括三個(gè)主要部分:gmond,gmetad,和網(wǎng)頁接口,通常被稱為ganglia- web。
gmond 是一個(gè)守護(hù)進(jìn)程,他運(yùn)行在每一個(gè)需要監(jiān)測的節(jié)點(diǎn)上,收集監(jiān)測統(tǒng)計(jì),發(fā)送和接受在同一個(gè)組播或單播通道上的統(tǒng)計(jì)信息。
gme tad 也是一個(gè)守護(hù)進(jìn)程,他定期檢查gmonds ,從那里拉取數(shù)據(jù),并將他們的指標(biāo)存儲(chǔ)在RRD存儲(chǔ)引擎中。它可以查詢多個(gè)集群并聚合指標(biāo)。RRD也被用于生成用戶界面的web前端。
ganglia- web 顧名思義,他應(yīng)該安裝在有g(shù)metad運(yùn)行的機(jī)器上,以便讀取RRD文件。
一般來說一個(gè)集群的每臺(tái)機(jī)器上都需要安裝gmond,只要負(fù)責(zé)展示web界面的機(jī)器安裝了gmetad即可。
二、安裝
1.apt-get install ganglia-monitor ganglia-webfrontend
彈出的對話框選擇Yes即可
可以看到安裝ganglia-webfrontend是包括gmetad和rrdtool等的。
2.鏈接到web服務(wù)器
安裝ganglia-webfrontend的時(shí)候就已經(jīng)安裝了Apache Web Server,Ganglia-webfrontend默認(rèn)安裝的位置是/usr/share/ganglia-webfront,現(xiàn)在還不能通過瀏覽器 訪問Ganglia監(jiān)控界面,需要執(zhí)行以下命令將將ganglia的文件鏈接到apache的默認(rèn)目錄下。
ln -s /usr/share/ganglia-webfront /var/www/ganglia?
3.復(fù)制 Ganglia webfrontend Apache 配置,使用下面的命令來正確的位置:
cp /etc/ganglia-webfrontend/apache.conf /etc/apache2/sites-enabled/ganglia.conf?
三、配置
1.配置gmond.conf
作下面的變化:
/* If a cluster attribute is specified, then all gmond hosts are wrapped inside * of a tag. If you do not specify a cluster tag, then all will * NOT be wrapped inside of a tag. */ cluster { name = "unspecified" owner = "unspecified" latlong = "unspecified" url = "unspecified" }?
修改為:
cluster { name = "my cluster"//自己設(shè)置的集群名 owner = "root" latlong = "unspecified" url = "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 port = 8649 ttl = 1 }?
修改為:
/* 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 = 192.168.10.128//改為主機(jī)的IP 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 udp_recv_channels as you like as well. */ udp_recv_channel { # mcast_join = 239.2.11.71 port = 8649 #bind = 239.2.11.71 }?
?
2.配置gmetad.conf
Vim /etc/ganglia/gmetad.confdata_source "my cluster" localhost
修改為:
data_source "my cluster"? 192.168.10.128:8649
3.需要重啟服務(wù):
/etc/init.d/ganglia-monitor restart /etc/init.d/gmetad restart /etc/init.d/apache2 restart如果遇到apache2 無法重啟的情況
vim /etc/apache2/apache2.conf最后加入一句 ServerName localhost:80即可。
4.現(xiàn)在你可以使用以下命令訪問gnglia webinterface:
http://192.168.10.128/ganglia/
?
四、監(jiān)測Hadoop集群性能
1.Master節(jié)點(diǎn)按上面的方法做,并在gmetad.conf中加入所有機(jī)器的IP地址。slave節(jié)點(diǎn)只需要安裝ganglia-monitor并配置gmond.conf即可。
2.在所有機(jī)器上配置hadoop-metrics.properties
修改Hadoop的配置文件/etc/hadoop/hadoop-metrics.properties,根據(jù)文件中的說明,修改五處:
dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext31 dfs.period=30 dfs.servers=192.168.10.128:8649mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext31 mapred.period=30 mapred.servers=192.168.10.128:8649jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext31 jvm.period=30 jvm.servers=192.168.10.128:8649rpc.class=org.apache.hadoop.metrics.ganglia.GangliaContext31 rpc.period=10 rpc.servers=192.68.10.128:8649ugi.class=org.apache.hadoop.metrics.ganglia.GangliaContext31 ugi.period=10 ugi.servers=192.168.10.128:8649
3.在所有機(jī)器上配置hadoop-metrics2.properties
在最后加上
*.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31*.sink.ganglia.period=10*.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both*.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40namenode.sink.ganglia.servers=192.168.10.128:8649resourcemanager.sink.ganglia.servers=192.168.10.128:8649datanode.sink.ganglia.servers=192.168.10.128:8649nodemanager.sink.ganglia.servers=192.168.10.128:8649maptask.sink.ganglia.servers=192.168.10.128:8649reducetask.sink.ganglia.servers=192.168.10.128:8649(后六行根據(jù)自己Hadoop情況配置)
也可以在一臺(tái)機(jī)器上配置后傳到其他機(jī)器上。
4.全部配置完畢后,重啟Hadoop環(huán)境,再重啟ganglia。
所有機(jī)器都需要ganglia-monitor restart
Master上還要做gmetad restart和apache2 restart。
然后就可以在頁面上看到Hadoop監(jiān)測相關(guān)的內(nèi)容。
做了一個(gè)WordCount程序測試,可以看到我運(yùn)行了WordCount的位置有明顯的網(wǎng)絡(luò)波動(dòng)。
?
另外全部安裝完后網(wǎng)頁左下角有個(gè)餅狀圖無法顯示,安裝了GD庫也還是不行
apt-get install php5-gd希望大家知道應(yīng)該怎么弄的告訴我一下,謝謝。
轉(zhuǎn)載于:https://www.cnblogs.com/dmyu/p/4668591.html
總結(jié)
以上是生活随笔為你收集整理的Ganglia的配置,用于监测系统和Hadoop性能的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: setfacl设置特定目录的权限
- 下一篇: 将可执行程序的内存空间扩展到3GB(wi