部署Ganglia

Ganglia是一个非常不错的集群性能监控软件,可以说是Hadoop集群的标配。下面来简单介绍一下ganglia的安装配置。

1.下载ganglia

下载链接参考官方链接:http://ganglia.info/?page_id=66
ganglia监控主要由这几部分组成:

  • gmetad(监控指标的集中收集程序)
  • gmond(安装在每个被监控机器的ganglia agent)
  • ganglia web(用于展示监控情况的一堆php程序)


这里下载ganglia-3.5.0.tar.gz和ganglia-web-3.5.0.tar.gz

2.下载完成后,开始编译ganglia

加入rpmforce的yum仓库
针对RHEL5和CentOS5

rpm -ivh http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

针对RHEL6和CentOS6

rpm -ivh http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
yum install -y apr apr-devel
yum install -y libconfuse libconfuse-devel
yum install -y pcre pcre-devel
yum install -y rrdtool rrdtool-devel

编译ganlgia

INSTALL_HOME='/opt/ganglia-3.5.0'
./configure --prefix=$INSTALL_HOME --with-gmetad
make
make install

3.配置ganglia

#针对服务端

cp gmetad/gmetad.init /etc/init.d/gmetad
sed -i "s#GMETAD=/usr/sbin/gmetad#GMETAD=$INSTALL_HOME/sbin/gmetad#g" /etc/init.d/gmetad
sed -i "s#daemon \$GMETAD#daemon \$GMETAD -c $INSTALL_HOME/etc/gmetad.conf#g" /etc/init.d/gmetad

#针对客户端

gmond/gmond -t > $INSTALL_HOME/etc/gmond.conf
cp gmond/gmond.init /etc/init.d/gmond
sed -i "s#GMOND=/usr/sbin/gmond#GMOND=$INSTALL_HOME/sbin/gmond#g" /etc/init.d/gmond
sed -i "s#daemon \$GMOND#daemon \$GMOND -c $INSTALL_HOME/etc/gmond.conf#g" /etc/init.d/gmond

4.配置gemtad和gmond

修改gmond.conf配置

#修改cluster的name
cluster {
  name = "unspecified"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}
#修改gmond udp send channel
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.
  host = opstool.com
  #mcast_join = 239.2.11.71
  port = 8649
  ttl = 1
}
#修改gmond udp recv channel
udp_recv_channel {
  #mcast_join = 239.2.11.71
  port = 8649
  #bind = 239.2.11.71
  retry_bind = true
}
#修改gmetad配置
data_source "opstool.com" opstool.com
gridname "opstool.com"

5.建立相应目录

mkdir -p /var/lib/ganglia
mkdir -p /var/lib/ganglia/rrds
mkdir -p /var/lib/ganglia/dwoo/compiled
mkdir -p /var/lib/ganglia/dwoo/cache
mkdir -p /var/lib/ganglia/conf
chown -R nobody:nobody /var/lib/ganglia
chown -R apache:apache /var/lib/ganglia/dwoo/compiled
chown -R apache:apache /var/lib/ganglia/conf
chown -R apache:apache /var/lib/ganglia/dwoo/cache

6.启动gmetad和gmond

/etc/init.d/gmetad start
/etc/init.d/gmond start

7.部署ganglia-web

将ganglia-web的包放到httpd的目录下,如/var/www/html/下。然后访问相应的地址,如http://ip/ganglia 就可以看到ganglia的web监控页了。

参考文档:
https://wiki.freebsdchina.org/howto/g/gangliainit
http://www.blogjava.net/xylz/archive/2011/07/21/354744.html

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 66 queries in 0.486 seconds