总算是将ganglia安装到了CentOS6.4上,在linux上进行应用的安装十分艰难,感觉是要碰运气,如果找到了一篇比较好的安装说明文档,则很快就可以完成,不然就是一个漫长痛苦的经历,分析原因:
1.对linux系统不熟悉,各种命令的意思不懂,对各种包的依赖关系不理解;
2.网上的很多写文章之人基础不同,文章基于自己的水平写,其中埋藏各种“想当然”的陷阱。
对于学习资料的整理原则:
1.进可能的全面打包各种相关资源。
2.假设拿到文档的人都是初学者。
3.记录各种异常情况。
此次安装大部分基于这篇文章: http://www.linuxidc.com/Linux/2014-02/96678.htm
有的地方没有走通,自己将问题解决!
下面是我基于上面文章的修改版,自己的安装过程,大部分为转载:
版本说明
CentOS版本:6.4 final;
Ganglia 版本:ganglia-3.4.0,ganglia-web-3.5.4;
Web服务:httpd-2.2.24;
PHP服务:php-5.3.18。
一、安装服务端
1、安装依赖
yum -y install apr-devel apr-utilcheck-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-develdbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devellibXrender-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker make rsync wget
yumgroupinstall chinese-support #安装中文支持
如果没有连接互联网,则需要将yum源配置到安装光盘(见第六章),使用以下命令:
yum --disablerepo=\* --enablerepo=c6-media -y install apr-devel apr-util check-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-devel dbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devel libXrender-devel perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker make rsync wget
yum --disablerepo=\* --enablerepo=c6-media groupinstall chinese-support
2、安装apache的组件
安装apr-1.4.6
wget http://apache.etoak.com//apr/apr-1.4.6.tar.gz
tar -xf apr-1.4.6.tar.gz && cdapr-1.4.6
./configure --prefix=/usr/local/apr&& make && make install && cd ..
安装apr-util-1.5.2
wget http://apache.etoak.com//apr/apr-util-1.5.2.tar.gz
tar -xf apr-util-1.5.2.tar.gz &&cd apr-util-1.5.2
./configure --prefix=/usr/local/apr-util--with-apr=/usr/local/apr && make && make install && cd..
安装httpd-2.2.24
wget http://mirror.esocc.com/apache//httpd/httpd-2.2.24.tar.gz
tar -xf httpd-2.2.24.tar.gz && cdhttpd-2.2.24
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most--with-included-apr --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util && make && make install&& cd ..
#将httpd写入启动脚本并启动(可选)
echo '/usr/local/apache2/bin/apachectlstart' >>/etc/rc.d/rc.local && /usr/local/apache2/bin/apachectlstart
3、安装和配置php
安装
wgethttp://www.php.net/get/php-5.3.18.tar.gz/from/cn2.php.net/mirror
tar -xf php-5.3.18.tar.gz && cdphp-5.3.18
./configure --prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs && make && make install&& cd ..
在httpd中配置php
修改/usr/local/apache2/conf/httpd.conf配置文件
添加内容
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
修改内容
在<IfModule dir_module>中添加index.php
4、安装libconfuse相关
wgethttp://pkgs.repoforge.org/libconfuse/libconfuse-2.6-2.el5.rf.x86_64.rpm
wgethttp://pkgs.repoforge.org/libconfuse/libconfuse-devel-2.6-2.el5.rf.x86_64.rpm
rpm -ivh libconfuse-*
5、安装pcre
wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.31.tar.gz
tar -xf pcre-8.31.tar.gz && cdpcre-8.31
./configure && make &&make install && cd ..
echo '/usr/local/lib'>/etc/ld.so.conf.d/libpcre.conf && ldconfig -v
6、安装rrdtool
wgethttp://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz
tar -xf rrdtool-1.4.7.tar.gz && cdrrdtool-1.4.7
./configure --prefix=/usr/local &&make && make install && cd ..
echo '/usr/local/lib'>/etc/ld.so.conf.d/librrd.conf && ldconfig -v
7、安装ganglia后台服务并设置
安装
wgethttp://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.4.0/ganglia-3.4.0.tar.gz/download
tar -xf ganglia-3.4.0.tar.gz && cdganglia-3.4.0
./configure --prefix=/usr/local/ganglia--with-gmetad --with-librrd=/usr/local/lib --sysconfdir=/etc/ganglia &&make && make install && cd ..
将gmond和gmetad作为服务运行,并加入开机服务启动中(可选)
复制到服务,并设开机启动
cp ganglia-3.4.0/gmond/gmond.init/etc/rc.d/init.d/gmond
cp ganglia-3.4.0/gmetad/gmetad.init/etc/rc.d/init.d/gmetad
chkconfig --add gmond && chkconfiggmond on
chkconfig --add gmetad &&chkconfig gmetad on
修改服务配置信息
修改/etc/rc.d/init.d/gmetad文件将GMETAD变量改为:GMETAD=/usr/local/ganglia/sbin/gmetad
和/etc/rc.d/init.d/gmond文件将GMOND变量改为:GMOND=/usr/local/ganglia/sbin/gmond
设置rrd的存储位置
mkdir -p /var/lib/ganglia/rrds
chown nobody:nobody /var/lib/ganglia/rrds
生成gmond的配置文件并修改配置信息(可选)
/usr/local/ganglia/sbin/gmond -t |tee/etc/ganglia/gmond.conf
修改cluster配置段内容,例如: name = "Cluster"。可以默认不修改
修改以下配置项,注释掉的为默认内容:
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 = 239.2.11.71*/
mcast_join = 192.168.1.5 #服务端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*/
retry_bind = true
}
修改gmetad的配置信息(可选)
修改/etc/ganglia/gmetad.conf配置文件
把data_source配置名称以及服务器名称修改为自己的。可以默认
把gridname前的注释放开,改为自己的名称,例如:"cluster"。可以默认
相关阅读:
使用Ganglia监控Hadoop集群 http://www.linuxidc.com/Linux/2012-05/61349.htm
在VMware Workstation的Ubuntu下安装和配置Hadoop与Ganglia http://www.linuxidc.com/Linux/2013-06/85856.htm
Ganglia安装部署之一建立Grid http://www.linuxidc.com/Linux/2013-05/83673.htm
Ganglia 极其简单安装教程yum版 http://www.linuxidc.com/Linux/2012-12/76536.htm
Ganglia快速开始向导(翻译自官方wiki) http://www.linuxidc.com/Linux/2013-11/92747.htm
CentOS集群上安装Ganglia-3.6.0监控Hadoop-2.2.0和HBase-0.96.0 http://www.linuxidc.com/Linux/2014-01/95804.htm
