服务端(master): 安装 ganglia ganglia-devel ganglia-gmetad ganglia-gmond ganglia-web ganglia-gmond-python rrdtool httpd php
客户端(slave) : 安装 ganglia-gmond
1 安装Ganglia
yum加入 epel 源
>rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum加入 remi 源
>rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
下载
http://ganglia.info/
安装依赖包
>yum install gcc apr apr-devel libconfuse libconfuse-devel expat-devel pcre pcre-devel –y
如果需安装gmetad
>yum install rrdtool rrdtool-devel -y
如果需安装gweb
>yum install rsync -y
安装gmond
>tar -zxvf ganglia-3.6.0.tar.gz
>cd ganglia-3.6.0/
>./configure
>make && make install
安装gmetad
>./configure --with-gmetad
>make && make install
配置gmond、gmetad服务
>cp gmetad/gmetad.init /etc/init.d/gmetad
>chkconfig --add gmetad
>cp gmond/gmond.init /etc/init.d/gmond
>chkconfig --add gmond
vim /etc/init.d/gmond
修改如下(find / =name ‘gmond‘搜索之):
GMOND=/usr/local/sbin/gmond
>vim /etc/init.d/gmetad
修改如下(find / =name ‘gmetad‘搜索之):
GMETAD=/usr/local/sbin/gmetad
为维护方便,修改配置路径:
>mkdir -p /etc/ganglia
>ln -s /usr/local/etc/gmetad.conf /etc/ganglia/gmetad.conf
>gmond -t > /usr/local/etc/gmond.conf
>ln -s /usr/local/etc/gmond.conf /etc/ganglia/gmond.conf
安装PHP
>yum --enablerepo=remi,remi-php55 install php-fpm php-common php-devel php-mysqlnd php-mbstring php-mcrypt
>chkconfig php-fpm on
安装Nginx
>yum install nginx -y
>chkconfig nginx on
Nginx配置php
>cd /etc/nginx/conf.d/
>mv default.conf defalut.conf.orig
>vim /etc/nginx/conf.d/defalut.conf
新增如下代码:
location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
启动服务
>service gmond start
>service gmetad start
>service php-fpm start
>service nginx start
测试PHP+Nginx
>cd /var/www
vim test.php
<?php phpinfo(); ?>
服务端本机访问:http//127.0.0.1:80/test.php,出现如下界面即为调试成功
安装Ganglia Web
>tar -zxvf ganglia-web-3.5.12.tar.gz
>cd ganglia-web-3.5.12/
>vim Makefile
GDESTDIR = /var/www/ganglia
APACHE_USER = apache # 与 /etc/php-fpm.d/www.conf 中user保持一致
>make install
Nginx新增ganglia文件目录访问配置
>vim /etc/nginx/conf.d/defalut.conf
location /ganglia {
root /var/www;
index index.html index.htm index.php;
}
>cd /var/www
>chown apache:apache ganglia/
>mkdir -p /var/lib/ganglia/rrds
>chown nobody:nobody /var/lib/ganglia/rrds
访问Ganglia Web
服务端本机访问:http//127.0.0.1:80/ganglia
呈现如下界面:(截图客户端访问)
2 配置Ganglia
服务器端
>vim /etc/ganglia/gmetad.conf
data_source "hadoop" master slave1 slave2
只需要更改 data_source一行,"hadoop"代表集群的名字,master,slave1,slave2,就是要监控的机器列表。默认端口8649。
启动服务
>service gmetad restart
>chkconfig gmetad on
监控端配置(需要监控的节点均要配置)
>vim /etc/ganglia/gmond.conf
将cluster选项中 name设置为gmetad中data_source指定的名称即可(hadoop)。
>service gmond restart
>chkconfig gmond on
3 配置hadoop2.2 hbase0.98.1
>vim hadoop-metrics2.properties #其他都注释掉
*.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31
*.sink.ganglia.period=10
*.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both
*.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40
namenode.sink.ganglia.servers=master:8649
resourcemanager.sink.ganglia.servers=master:8649
datanode.sink.ganglia.servers=master:8649
nodemanager.sink.ganglia.servers=master:8649
maptask.sink.ganglia.servers=master:8649
reducetask.sink.ganglia.servers=master:8649
>vim hadoop-metrics2-hbase.properties #其他都注释掉
sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31
*.sink.ganglia.period=10
hbase.sink.ganglia.period=10
hbase.sink.ganglia.servers=master:8649
4 重启 apache,重启hbase hadoop集群
异常:
zlib library not configured properly
解决:
参考:
http://hi.baidu.com/qingchunranzhi/item/b937b5e40f095debfb42ba66
http://blog.****.net/xxd851116/article/details/25346553
http://blog.****.net/baiyangfu_love/article/details/16118369
Ganglia3.6.0,nginx+php搭建gweb,监控Hadoop2.2 和 Hbase0.98.1,布布扣,bubuko.com