Server端:
yum install rrdtool ganglia ganglia-gmetad ganglia-gmond ganglia-web httpd php
Client端:
yum install ganglia-gmond
创建RRD目录
mkdir -p /var/lib/ganglia/rrds
chown ganglia:ganglia /var/lib/ganglia/rrds
编辑/etc/ganglia/gmond.conf
cluster {
name = "DFS"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
udp_send_channel {
#bind_hostname = yes # Highly recommended, soon to be default.
# This option tells gmond to use a source address
# that resolves to the machine's hostname. Without
# this, the metrics may appear to come from any
# interface and the DNS names associated with
# those IPs will be used to create the RRDs.
mcast_join = master.hadoop.test
port = 8649
ttl = 1
}
/* You can specify as many udp_recv_channels as you like as well. */
udp_recv_channel {
port = 8649
bind = master.hadoop.test
}
/* 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 {
bind = master.hadoop.test
port = 8649
}
编辑/etc/ganglia/gmetad.conf
data_source "DFS" master.hadoop.test:8649
安装ganglia-web
cd /var/www/html
tar zxvf ganglia-web-3.5.7.tar.gz
mv ganglia-web-3.5.7 ganglia
修改Apache配置
vim /etc/httpd/conf.d/ganglia.conf
<Location /ganglia>
Order deny,allow
Allow from all
</Location>
# 开机运行采集进程
chkconfig --levels 235 gmond on
# 开机运行数据存储进程
chkconfig --levels 235 gmetad on
# 开机运行apache服务
chkconfig --levels 235 httpd on
启动服务
service gmond start
service gmetad start
service httpd restart
修改hadoop配置:
vim $HADOOP_HOME/conf/hadoop-metrics.properties
# Configuration of the "dfs" context for ganglia
dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
dfs.period=10
dfs.servers=master.hadoop.test:8649
# Configuration of the "mapred" context for ganglia
mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
mapred.period=10
mapred.servers=master.hadoop.test:8649
# Configuration of the "jvm" context for ganglia
jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
jvm.period=10
jvm.servers=master.hadoop.test:8649
rpc.class=org.apache.hadoop.metrics.ganglia.GangliaContext31
rpc.period=10
rpc.servers=master.hadoop.test:8649
重启Hadoop
访问http://${ganglia_home}/ganglia
作者:j2eelamp 发表于2013-12-11 19:00:40
原文链接