今天在部署Flume配置的时候,为了满足更直观的展示出效果,特地学习安装了Ganglia,接下来就详细的为大家介绍一下整个操作流程及部署过程中所遇到的问题。
安装httpd服务与php
yum -y install httpd php
安装其他依赖
yum -y install rrdtool perl-rrdtool rrdtool-devel
yum -y install apr-devel
安装ganglia
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install ganglia-gmetad
yum -y install ganglia-gmetad
yum install -y ganglia-gmond
在安装Ganglia的时候出现了如下所示的错误信息。
[root@admin01 flume-telnet]# yum install -y ganglia-gmetad
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
[root@admin01 flume-telnet]# yum -y install ganglia-gmetad
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
[root@admin01 flume-telnet]# yum -y install ganglia-web
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
[root@admin01 flume-telnet]# yum install -y ganglia-gmond
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
经过查阅可知,在安装相应的依赖时会在/etc/yum.repos.d
里面多出下面两个文件。
解决方法
此时,需要对其中的epel.repo
里面进行操作,具体的操作如下:
把/etc/yum.repos.d/epel.repo
,文件中第三行注释去掉,把第四行注释掉。
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
修改为:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
再清理源,重新安装
1. yum clean all
2. yum -y install ganglia-gmetad
3. yum -y install ganglia-gmetad
4. yum install -y ganglia-gmond
如果还是不行,则修改DNS信息,到 /etc/resolv.conf 下添加一行:
nameserver 8.8.8.8
serarch localdomain
然后重启network服务:
service network restart # centos-6版本
systemctl restart network # centos-7版本
修改配置文件ganglia.conf
文件ganlia.conf
[root@admin01 ~]# vi /etc/httpd/conf.d/ganglia.conf
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
Order deny,allow
Deny from all
Allow from 127.0.0.1
# Allow from ::1
# Allow from .example.com
</Location>
修改为:
[root@admin01 ~]# vi /etc/httpd/conf.d/ganglia.conf
#
# Ganglia monitoring system php web frontend
#
Alias /ganglia /usr/share/ganglia
<Location /ganglia>
Order deny,allow
Deny from all
Allow from all
# Allow from 127.0.0.1
# Allow from ::1
# Allow from .example.com
</Location>
文件gmetad.conf :
[root@admin01 ~]# vi /etc/ganglia/gmetad.conf
# 添加配置信息:
data_source "admin01" 192.168.47.101
[root@admin01 ~]# vi /etc/ganglia/gmond.conf
# 添加配置信息:
cluster {
name = "admin"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
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
host = 192.168.47.101
port = 8649
ttl = 1
}
udp_recv_channel {
# mcast_join = 239.2.11.71
port = 8649
bind = 192.168.47.101
retry_bind = true
# Size of the UDP buffer. If you are handling lots of metrics you really
# should bump it up to e.g. 10MB or even higher.
# buffer = 10485760
}
文件config:
# vi /etc/selinux/config
修改为:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
注意
selinux本次生效关闭必须重启,如果此时不想重启,可以临时生效之:
[root@admin01 ganglia]# setenforce 0
setenforce: SELinux is disabled
这里是在准备虚拟机环境的时候就已经关闭了,因此再次执行,会是上述所示的效果。
启动Ganglia
[root@admin01 ganglia]# service httpd start
Starting httpd:
[root@admin01 ganglia]# service gmetad start
Starting GANGLIA gmetad: [ OK ]
[root@admin01 ganglia]# service gmond start
Starting GANGLIA gmond: [ OK ]
浏览Ganglia页面
此时,可能会报出404的页面错误,这是因为/var/lib/ganglia
操作权限不够,因此我们需要对其赋予一定的权限,才能使其正常运行起来。
chmod -R 777 /var/lib/ganglia
记得需要重新启动Ganglia服务哈!页面信息就会如图所示:
到这里,整个Ganglia的部署就算是告一段落啦!
加油,致最好的年华!