安装Ganglia监控hadoop

Ganglia安装
安装Ganglia监控hadoop
yum -y install httpd-devel automake autoconf libtool ncurses-devel libxslt groff pcre-devel pkgconfig
安装ganglia-gmetad 和 ganglia-web
yum search ganglia
yum -y install ganglia-web.x86_64 ganglia-gmond.x86_64 
rpm -qa |grep ganglia          --------------------查看安装情况  
rpm -ql ganglia-web-3.1.7-6.el6.x86_64     ------------- 复制上面命令执行结果的安装名,可查看安装路径 
配置gmetad  
vi /etc/ganglia/gmond.conf
cluster {
  name = "hadoop-cluster"         #集群名称
  owner = "ganglia"               #运行Ganglia的用户
  latlong = "unspecified"
  url = "unspecified"

udp_send_channel {
  mcast_join = 239.2.11.71     
  host = hadoop-master.dragon.org                 #发送给安装gmetad的机器
  port = 8649                   #监听端口
  ttl = 1

vi /etc/ganglia/gmetad.conf 
data_source "my cluster" localhost改为data_source "hadoop-cluster" 10 localhost  hadoop-master.dragon.org:8649
data_source "Hadoop" localhost hadoop-master.dragon.org  ---- Hadoop为cluster名称,后面是需要监控的主机名  
修改apache设置
vi /etc/httpd/conf.d/ganglia.conf  
文件内容Deny from all 为 allow from all
设置启动 
# chkconfig --add gmetad  
# chkconfig --add gmond  
# chkconfig --add httpd 
在主机上
service gmetad start
service gmond start
service httpd start
service gmetad stop
service gmond stop
service httpd stop


# service gmetad status    -------------------验证是否启动成功
# service gmond status   -------------------验证是否启动成功 
/ganglia/conf.php
$ganglia_ip = “127.0.0.1”; $ganglia_port=”8649”;
访问http://192.168.192.129/ganglia


$gmetad_root = "/var/lib/ganglia";
$rrds = "$gmetad_root/rrds";
define("RRDTOOL", "/usr/bin/rrdtool");
这两个变量与gmetad的配置一致,以正确获取到rrdtools存储的数据即可
常见问题
Forbidden错误时,因为对apache有一个设置
修改 /etc/httpd/conf.d/ganglia.conf文件内容Deny from all 为 allow from all
There was an error collecting ganglia data (127.0.0.1:8652):fsockopen error: Permission denied 解决方法
1 永久方法 – 需要重启服务器
修改/etc/selinux/config文件中设置SELINUX=disabled ,然后重启服务器。
2 临时方法 – 设置系统参数
使用命令setenforce 0
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式
There was an error collecting ganglia data (127.0.0.1:8652):fsockopen error: Connection refused 解决办法
卸载yum remove ganglia-web ganglia-gmetad
重新安装yum install ganglia-web    ----- ganglia-web本身有引用gmetad
重启即可
后来遇到错误: 
Cannot find any metrics for selected cluster "hadoop", exiting. Check ganglia XML tree (telnet 127.0.0.1 8652)   
弄了好久,最后在/var/www/html/ganglia/conf.php文件中修改了一下 $ganglia_ip = “127.0.0.1”; $ganglia_port=”8649”; 
这的端口号要和你在gmond.conf  中的一样




rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm


国内访问修改为sohu提供的镜像:
vi /etc/yum.repos.d/epel.repo 
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
baseurl=http://mirrors.sohu.com/fedora-epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
 
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 6 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug
baseurl=http://mirrors.sohu.com/fedora-epel/6/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1
 
[epel-source]
name=Extra Packages for Enterprise Linux 6 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS
baseurl=http://mirrors.sohu.com/fedora-epel/6/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
gpgcheck=1

你可能感兴趣的:(hadoop,监控,安装ganglia)