阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6.4 上安装Ganglia

153次阅读
没有评论

共计 17236 个字符,预计需要花费 44 分钟才能阅读完成。

总算是将 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

8、安装 ganglia 的 web 端以及设置

下载和解压

wgethttp://sourceforge.net/projects/ganglia/files/ganglia-web/3.5.4/ganglia-web-3.5.4.tar.gz/download

tar -xf ganglia-web-3.5.4.tar.gz

cp -r ganglia-web-3.5.4/usr/local/apache2/htdocs/ganglia

修改 Makefile 文件并安装

cd /usr/local/apache2/htdocs/ganglia

修改 Makefile 中 GDESTDIR 和 APACHE_USER 参数,然后执行 make install 安装

GDESTDIR=/usr/local/apache2/htdocs/ganglia

APACHE_USER=daemon

make install

修改 php 配置文件

cp conf_default.php conf.php

修改 conf.php 文件

如果设置 rrd 的存储位置的时候是按照上文设置的话,就可以跳过对 $conf[‘gmetad_root’] 和 $conf[‘rrds’] 的修改,否则改为相应位置

$conf[‘rrdtool’] =”/usr/local/bin/rrdtool”;

$conf[‘external_location’] = http://localhost/ganglia;

$conf[‘case_sensitive_hostnames’] = false;

9、启动 ganglia

启动或重启 httpd

/usr/local/apache2/bin/apachectl start

启动 gmetad

service gmetad start

启动 gmond

service gmond start

二、安装客户端

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

2、安装 libconfuse 相关

rpm -ivh libconfuse-*

3、安装 pcre

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

 

4、安装和配置 ganglia

安装

tar -xf ganglia-3.4.0.tar.gz && cdganglia-3.4.0

./configure –prefix=/usr/local/ganglia–sysconfdir=/etc/ganglia && make && make install && cd..

配置

复制服务端配置

scp 192.168.1.130:/etc/rc.d/init.d/gmond/etc/rc.d/init.d/gmond

scp 192.168.1.130:/etc/ganglia/gmond.conf /etc/ganglia

把 gmond 加入服务并开机启动

chkconfig –add gmond && chkconfiggmond on

5、启动 ganglia 客户端

service gmondstart

或者:/etc/init.d/gmond start

 

ps –ef | grep gmond

检查 gmond 进程是否启动成功

三、特殊要求

如果你的服务器有两块网卡,eth0 使用公网地址,eth1 使用局域网地址,而你的监控服务器和被监控服务器之间的通信你希望通过局域网地址实现以减少公网网卡的负载,那么可以使用以下命令

ip route add 239.2.11.71 dev eth1

因为 239.2.11.71 是 ganglia 默认的多点传输通道,所以要加一条路由使它通过 eth1, 也就是内网网卡,239.2.11.71 这个地址你可以在 /etc/ganglia/gmond.conf 中修改

四、错误分析

1、apr 错误

Checking for apr

checking for apr-1-config… no

configure: error: apr-1-config binary notfound in path

解决

yum -y install apr-devel apr-utilexpat-devel

2、confuse 错误

Checking for confuse

checking for cfg_parse in -lconfuse… no

Trying harder including gettext

checking for cfg_parse in -lconfuse… no

Trying harder including iconv

checking for cfg_parse in -lconfuse… no

libconfuse not found

解决

rpm -ivh libconfuse-*

3、expat 错误

Checking for expat

checking for XML_ParserCreate in-lexpat… no

libexpat not found

解决

yum install expat-devel

4、pcre 错误

Checking for pcre

checking pcre/pcre.h usability… no

checking pcre/pcre.h presence… no

checking for pcre/pcre.h… no

checking pcre.h usability… no

checking pcre.h presence… no

checking for pcre.h… no

checking for pcre_compile in -lpcre… no

libpcre not found, specify–with-libpcre=no to build without PCRE support

解决

安装 pcre

5、乱码错误

缺少字体文件,由于 CentOS 最小化安装缺少一些字体文件,可以从别的机器复制过来,或这见附件,放到 /usr/share/fonts/ 中,或者使用命令:yumgroupinstall  chinese-support,然后重启 httpd

6、ganglia 的 web 页面显示错误

It is not safe to rely on the system’stimezone settings. You are *required* to use the date.timezone setting or thedate_default_timezone_set() function.

解决

修改 php.ini 文件,修改参数:date.timezone = PRC

修改 /usr/local/apache2/htdocs/ganglia/header.php 文件,在第二行添加:date_default_timezone_set(“PRC”);

错误中的错误

找不到 php.ini 文件

解决

复制 php 安装文件夹下的 php.ini-production 文件到 /etc/php.ini

也可以重新编译安装 php,加入编译参数 –with-config-file-path=/usr/local/php/etc 来手工指定 php 配置文件路径,然后把 php.ini-production 文件复制到 /usr/local/php/etc/php.ini

7、httpd 启动报错

错误 1

httpd: apr_sockaddr_info_get() failed forganglia

httpd: Could not reliably determine theserver’s fully qualified domain name, using 127.0.0.1 for ServerName

原因

没有在 apache 的 conf/http.conf 中设定 ServerName。所以 apache 会用主机上的名称来取代,首先会去找 /etc/hosts 中有没有主机的定义。

解决

设定 httpd.conf 文件中的 ServerName:ServerName localhost:80

在 /etc/hosts 中填入自己的主机名称:127.0.0.1 server1

错误 2

httpd: Syntax error on line 140 of/usr/local/apache2/conf/httpd.conf: Cannot load modules/mod_dir.so into server:/usr/local/apache2/modules/mod_dir.so: undefined symbol: apr_array_clear

原因

apache 编译的时候缺少模块

解决

重新编译,制定参数 –with-included-apr

8、ganglia 启动失败

[function.mkdir]: Permission denied

应该是 Makefile 中设置的用户名 daemon 错误,这个用户名要和 httpd.conf 中的 User 和 Group 一致,否则导致无权限读写文件,并且修改 Makefile 后要运行 make install 安装,否则仍然报错

9、yum 提示 anotherapp is currently holding the yum lock;waiting for it to exit

可能是系统自动升级正在运行,yum 在锁定状态中。
可以通过强制关掉 yum 进程:
rm -f /var/run/yum.pid
然后就可以使用 yum 了

五、监控 Hadoop

1、配置 hadoop-metrics 文件

Hadoop 版本为 chd3u3, 修改 conf 文件夹下的 hadoop-metrics.properties 文件,将 ganglia 相关的配置条目的注释符去除,注意 ganglia 的版本部分。如下:

# Configuration of the “dfs” context for null

dfs.class=org.apache.hadoop.metrics.spi.NullContext

 

# Configuration of the “dfs” context for file

#dfs.class=org.apache.hadoop.metrics.file.FileContext

#dfs.period=10

#dfs.fileName=/tmp/dfsmetrics.log

 

# Configuration of the “dfs” context for ganglia

# Pick one: Ganglia 3.0 (former) or Ganglia 3.1 (latter)

# dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext

dfs.class=org.apache.hadoop.metrics.ganglia.GangliaContext31

dfs.period=10

dfs.servers=192.168.1.130:8649

 

 

# Configuration of the “mapred” context for null

mapred.class=org.apache.hadoop.metrics.spi.NullContext

 

# Configuration of the “mapred” context for file

#mapred.class=org.apache.hadoop.metrics.file.FileContext

#mapred.period=10

#mapred.fileName=/tmp/mrmetrics.log

 

# Configuration of the “mapred” context for ganglia

# Pick one: Ganglia 3.0 (former) or Ganglia 3.1 (latter)

# mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext

mapred.class=org.apache.hadoop.metrics.ganglia.GangliaContext31

mapred.period=10

mapred.servers=192.168.1.130:8649

 

 

# Configuration of the “jvm” context for null

#jvm.class=org.apache.hadoop.metrics.spi.NullContext

 

# Configuration of the “jvm” context for file

#jvm.class=org.apache.hadoop.metrics.file.FileContext

#jvm.period=10

#jvm.fileName=/tmp/jvmmetrics.log

 

# Configuration of the “jvm” context for ganglia

jvm.class=org.apache.hadoop.metrics.ganglia.GangliaContext

jvm.period=10

jvm.servers=192.168.1.130:8649

 

 

# Configuration of the “ugi” context for null

ugi.class=org.apache.hadoop.metrics.spi.NullContext

 

 

# Configuration of the “fairscheduler” context for null

#fairscheduler.class=org.apache.hadoop.metrics.spi.NullContext

 

# Configuration of the “fairscheduler” context for file

#fairscheduler.class=org.apache.hadoop.metrics.file.FileContext

#fairscheduler.period=10

#fairscheduler.fileName=/tmp/fairschedulermetrics.log

 

# Configuration of the “fairscheduler” context for ganglia

fairscheduler.class=org.apache.hadoop.metrics.ganglia.GangliaContext

fairscheduler.period=10

fairscheduler.servers=192.168.1.130:8649

#
 

加粗部分为修改内容,192.168.1.130 为 ganglia 服务端 ip 地址!

2、重启 hadoop 集群

 

六、配置 yum 本地源

首先将 CentOS 安装光盘挂载到文件系统上,我们这里以挂载到 /mnt/CentOS 目录下为例,执行“mkdir /mnt/CentOS”命令创建挂在目录,然后执行“mount /dev/cdrom /mnt/CentOS”命令,将光盘挂载到指定目录下。

进入 /etc/yum.repos.d 目录, 将该目录下的三个文件备份,分别执行“cp CentOS-Base.repoCentOS-Base.repo.bak”“cp CentOS-Media.repoCentOS-Media.repo.bak”“cp CentOS-Debuginfo.repoCentOS-Debuginfo.repo.bak”命令备份成功后,将 CentOS-Base.repo 文件删除,然后修改 CentOS-Media.repo 文件

修改前文件内容如下:

[c6-media]

name=CentOS-$releasever – Media

baseurl=file:///media/CentOS/

        file:///media/cdrom/

        file:///media/cdrecorder/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
 

修改后的文件内容如下:

[c6-media]

name=CentOS-$releasever – Media

baseurl=file:///mnt/CentOS/

        file:///media/cdrom/

        file:///media/cdrecorder/

…..
 

注意,要在 yum 命令中使用本地源,需要在命令中加入以下参数:

–disablerepo=\* –enablerepo=c6-media

例如:

yum –disablerepo=\* –enablerepo=c6-media[command]

更多 CentOS 相关信息见 CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

总算是将 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

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计17236字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中