1. 安装Apache 2.2.3
./configure --prefix=/usr/local/apache --enable-so --enable-mods-shared=most CFLAGS=-fPIC
# make
# make install
----------------------------------启动Apache服务----------------------------------
# /usr/local/apache/bin/apachectl start
----------------------------------关闭Apache服务----------------------------------
# /usr/local/apache/bin/apachectl stop
----------------------------------重启Apache服务----------------------------------
# /usr/local/apache/bin/apachectl restart
2. 安装PHP 5.1.6
# ./configure --prefix=/usr/local/php /
--with-mysqld=/usr/local/mysql /
--with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
if has error: make clean
3. 配置Apache服务的httpd.conf文件
*在LoadModule处添加 LoadModule php5_module module/libphp5.so
*在DirectoryIndex处添加 index.php
*在AddType application处添加
AddType application/x-httpd-php .php .phtml
AddType applicatoin/x-httpd-php-source .phps
然后,vi /usr/local/apache/conf/httpd.conf,添加:
SetHandler application/x-httpd-php
SetHandler application/x-httpd-php
SetHandler application/x-httpd-php-source
LoadModule php5_module modules/libphp5.so
DirectoryIndex index.html index.php
4. libconfuse的安装
./configure CFLAGS=-fPIC --disable-nls
make && make install
调整lib库的位置:
vi /etc/ld.so.conf.d/libconfuse.conf,添加:/usr/local/lib,然后/sbin/ldconfig -v
5. RRDTool的安装:
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
tar -zxvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/usr/local
make && make install
调整lib库的位置:
vi /etc/ld.so.conf.d/librrd.conf,添加:/usr/local/lib,然后/sbin/ldconfig -v
6. Ganglia的安装:
要注意的是,Ganglia在安装时默认不安装gmetad,所以需要在configure时指定:--with-gmetad,还需要指定RRDTool库的路径:--with-librrd=… !
wget http://sourceforge.net/projects/ganglia/files/ganglia%20monitoring%20core/3.1.7/ganglia-3.1.7.tar.gz/download
tar -zxvf ganglia-3.1.7.tar.gz
cd ganglia-3.1.7
./configure --with-gmetad --with-librrd=/usr/local/lib --sysconfdir=/etc/ganglia
make
make install
需要进一步的操作,添加gmond和gmetad为系统服务:
cp gmond/gmond.init /etc/rc.d/init.d/gmond
cp gmetad/gmetad.init /etc/rc.d/init.d/gmetad
chkconfig --add gmond
chkconfig --add gmetad
7. Ganglia的简单配置:
生成gmond默认配置文件:
gmond -t |tee /etc/ganglia/gmond.conf
服务器端配置文件gmetad.conf,主要是配置data_source参数。它设定了监控服务器的地址及端口,可以指定多个监控服务器:
data_source “hadoop” 10 192.168.9.45
data_source是最重要的参量,在GMOND的Cluser name配置必须与data_source的相同,这个参量被设置为
群的名字,被监测以便能监测集群状态。如果有二个或更多监测对象,当有一对象不能被监测,将读取data_source 配置的下一个对象。
grid_name “hadoop cluster status” /*设置一个web前端显示的名称,随意命名。
8. Ganglia web前端的安装:
mkdir /var/www/html/ganglia
cp -r web/* /var/www/html/ganglia
9. Python 2.7
./configure --enable-shared
10. ganglia客户端安装
#./configure --prefix=/usr/local/ganglia --sysconfdir=/etc/ganglia
./configure --sysconfdir=/etc/ganglia
该命令需要装四个库:#apt-get install libapr1-dev libconfuse-dev libexpat1-dev libpcre3-dev
#make & make install
配置
cd ganglia-3.1.7/gmond
#mkdir /etc/ganglia
#./gmond -t >/etc/ganglia/gmond.conf
#cp gmond.init /etc/init.d/gmond
#cp gmond /usr/sbin/gmond
#chkconfig gmond on
#chkconfig --list gmond
启动服务:
#gmond start
验证gmond正常工作:telnet localhost 8649
配置/etc/ganglia/gmond.conf:
globals{
setuid = yes
user = root
......
}
cluster{
name = "shaidian"
......
}
重启gmond: #gmond restart
$gmond -d1
11. 部署客户端
# for i in `cat /tmp/mynodes`; do
scp /usr/sbin/gmond $i:/usr/sbin/gmond
ssh $i mkdir -p /etc/ganglia/
scp /etc/ganglia/gmond.conf $i:/etc/ganglia/
scp /etc/init.d/gmond $i:/etc/init.d/
scp /usr/lib64/libganglia-3.1.1.so.0 $i:/usr/lib64/
scp /lib64/libexpat.so.0 $i:/lib64/
scp /usr/lib64/libconfuse.so.0 $i:/usr/lib64/
scp /usr/lib64/libapr-1.so.0 $i:/usr/lib64/
scp -r /usr/lib64/ganglia $i:/usr/lib64/
ssh $i service gmond start
done