0
点赞
收藏
分享

微信扫一扫

ganglia3.1.7 tarball安装笔记 (Cent5.5 64bit)


前言

    安装ganglia过程还是很麻烦的,之前我写过一篇文章通过yum安装ganglia3.0,但是yum库中没有找到ganglia3.1和3.2的rpm包,为了尝鲜我首先安装了ganglia3.2版本,服务配置都正常就是找不到client机器,万分无奈切换到3.1.7版本,最后很顺利使用单播方式安装成功(我的服务器是双网卡,使用多播配置总是找不到client机器,配置了route还是不行,最后放弃)

安装依赖库


#添加rpmforge库到yum 
  
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm 
  
rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

 


# 安装依赖, 32位的安装自己通过"yum list name"找到下面几个库就可以 
  
yum install rrdtool.x86_64 rrdtool-devel.x86_64 expat.x86_64 expat-devel.x86_64 apr.x86_64 apr-devel.x86_64 apr-util.x86_64 apr-util-devel.x86_64 *confuse*


安装ganglia



#下载ganglia 3.1.7
wget http://cdnetworks-kr-1.dl.sourceforge.net/project/ganglia/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz



 



#安装
tar -zxf ganglia-3.1.7.tar.gz && cd ganglia-3.1.7

./configure --with-gmetad --sysconfdir=/etc/ganglia --enable-gexec --with-python=/usr/local/bin/python2.7
make && make install

*****************

这里我在make的时候,发生错误“/usr/local/lib/libpython2.7.a: could not read symbols: Bad value”

解决办法:需要重装python 带上 --enable-shared 参数,如下:

./configure --enable-shared && make && make install



ganglia配置


# 准备目录 
  
mkdir -p /var/lib/ganglia/rrds 
  
mkdir -p /var/lib/ganglia/dwoo 
  
mkdir -p /var/www/html/ganglia 
  

# 确保当前目录为“ganglia-3.1.7” 
  

# ganglia3.2在64位下要拷贝下面两个启动文件(3.1.7版本不需要),否则 service 命令找不到程序 
  
# cp /usr/local/sbin/gmetad /usr/sbin 
  
# cp /usr/local/sbin/gmond /usr/sbin 
  

cp gmond/gmond.init /etc/rc.d/init.d/gmond #添加gmond到service 
  
cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad #添加gmetad到service 
  
chkconfig --add gmond # gmond开机启动 
  
chkconfig --add gmetad # gmetad 开机启动 
  
cp -r web/* /var/www/html/ganglia # copy ganglia web文件倒apache 
  
chown -R apache:apache /var/lib/ganglia/dwoo/ 
  
chown -R nobody:nobody /var/lib/ganglia/rrds/ 
  

gmond -t |tee /etc/ganglia/gmond.conf #生成gmond默认配置文件,tee的作用类似重定向符“>>” 
  

***************** 
  
# 几个重要的文件路径(3.2和3.1.7存放路径不一样,大家自己which和find查找吧) 
  
/usr/local/bin/gstat #测试工具,我在多播模式下,不能使用,单播可以,奇怪.... 
  
  
  
/usr/local/sbin/gmetad #中央服务程序,通过"gmetad -d1"打印启动日志(3.17在/usr/sbin/gmetad) 
  
/usr/local/sbin/gmond # 监控数据采集程序,通过"gmond -d1"打印启动日志(3.17在/usr/sbin/gmond) 
  

/etc/ganglia/gmetad.conf 
  
/etc/ganglia/gmond.conf


 


#配置gmeta 
  
vi /etc/ganglia/gmetad.conf 
  
data_source "hadoop" 192.168.1.10 # 集群名称,这里我配置为“hadoop”, 192.168.1.10 为集群中央机器

 



#配置gmond(单播) 
  
vi /etc/ganglia/gmond.conf 
  

cluster { 
  
name = "hadoop" #与gmetad.conf 相同的名称 
  
.... 
  
} 
  

udp_send_channel { 
  
  #mcast_join = 239.2.11.71 #这行被注释 
  
  host = 192.168.1.10 #中央机器的IP # 添加改行 
  
  port = 8649 
  
  ttl = 1 
  
} 
  

udp_recv_channel { 
  
  # mcast_join = 239.2.11.71 #这行被注释 
  
  port = 8649 
  
  # bind = 239.2.11.71 #这行被注释 
  
}




启动和测试



service gmetad start
service gmond start
service httpd start 

telnet localhost 8649 # 检查gmond进程,如果出现XML就对了
telnet localhost 8651 # 检查gmetad进程,如果出现XML就对了

打开浏览器,访问 http://{you_ip}/ganglia/就可以看到Web界面了

*****************
gmetad启动后执行“service gmetad status”,报错“ gmetad dead but subsys locked ”
解决:chown -R nobody:nobody /var/lib/ganglia

httpd启动时报错“Could not reliably determine the server's fully qualified domain name”
解决:vi /etc/httpd/conf/httpd.conf,设置

ServerName localhost:80

 

如果出图有问题,如出现"localhost"而没有显示机器名,则可能因为/etc/hosts没有正确配置IP与机器名映射关系。



添加Web访问密码



htpasswd -c /etc/httpd/conf.d/passwords ganglia #创建用户名密码,我这里用户名为“ganglia”



 


vi /var/www/html/ganglia/.htaccess #要指定刚才创建的用户名 
  
AuthType Basic 
  
AuthName "Restricted Files" 
  
AuthUserFile /etc/httpd/conf.d/passwords 
  
Require user ganglia



vi /etc/httpd/conf/httpd.conf  #添加目录 
  

<Directory "/var/www/html/ganglia/"> 
  
    AllowOverride AuthConfig 
  
    Options Indexes MultiViews 
  
    Order allow,deny 
  
    Allow from all 
  
    AuthType Basic 
  
    AuthName "Restricted Files" 
  
    AuthUserFile /etc/httpd/conf.d/passwords 
  
    Require user ganglia 
  
</Directory>


客户端部署

为了方便在服务端想客户端执行命令,我使用了批量工具“pdsh”,具体安装参考我博客文章。安装rpmforce库后,可以通过“yum install pdsh”安装。

 



配置好Server到client无密码SSH访问



 



#在Server端执行,这个脚本在不同OS,不同ganglia版本会区别 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/sbin/gmond %h:/usr/sbin/gmond 
  
pdsh -w ssh:192.168.1.[50-100,120-150] mkdir -p /etc/ganglia/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/ganglia/gmond.conf %h:/etc/ganglia/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /etc/init.d/gmond %h:/etc/init.d/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libganglia-3.1.7.so.0 %h:/usr/lib64/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /lib64/libexpat.so.0 %h:/lib64 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libconfuse.so.0 %h:/usr/lib64/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp /usr/lib64/libapr-1.so.0 %h:/usr/lib64/ 
  
pdsh -w exec:192.168.1.[50-100,120-150] scp -r /usr/lib64/ganglia %h:/usr/lib64/ 
  
pdsh -w ssh:192.168.1.[50-100,120-150] service gmond start 
  
pdsh -w ssh:192.168.1.[50-100,120-150] chkconfig --add gmond


 

参考:

http://www.blogjava.net/xylz/archive/2011/07/21/354744.html

http://yifangyou.blog.51cto.com/900206/633002

 

-- end --

 

 

 

 

 

 

 

举报

相关推荐

0 条评论