Ganglia安装及配置
root用户下yum安装所依赖的环境(实际生产环境都已安装)
yum -y install apr-develapr-util check-devel cairo-devel pango-devel libxml2-devel rpmbuild glib2-develdbus-devel freetype-devel fontconfig-devel gcc-c++ expat-devel python-devellibXrender-devel
yum -y install expat expat-devel pcre pcre-devel zlib cairo-devel libxml2-devel pango-devel pango libpng-devel libpng freetype freetype-devel libart_lgpl-devel apr-devel
以下为实际生产环境下rmbmon用户安装的所有源码包
mkdir -p /app/ganglia/
Python-2.7的安装 (主、从都安装)
安装路径:/app/ganglia/python
源码包:Python-2.7.tgz
步骤:cd /app/ganglia
tar -xvf Python-2.7.tgz
cd Python-2.7
./configure --prefix=/app/ganglia/python
如果在make编译报错字符集错误,可以暂时将LANG修改为C待成功安装成功后 再改回来(env | grep LANG LANG=zh_CN.GB18030(原) LANG=C)
make
make install
修改环境变量
view /app/rmbmon/.bash_profile
PATH=/app/ops/python/bin:$PATH:$HOME/bin
export PATH
LANG=zh_CN.GB18030
为了ganglia安装不报错修改lib名称
cd /app/ganglia/python
mv lib/ lib64/
confuse的安装(主、从都安装)
安装路径:/app/ganglia/confuse/confuse2
源码包:confuse-2.6.tar.gz
步骤:cd /app/ganglia/confuse
tar -xvf confuse-2.6.tar.gz
cd /app/ganglia/confuse/confuse-2.6
./configure CFLAGS=-fPIC --disable-nls --prefix=/app/ganglia/confuse/confuse2
make
make install
make 报错
MF .deps/lexer.Tpo -c lexer.c -o lexer.o
cc1: warnings being treated as errors
lexer.c:1582: error: ‘input‘ defined but not used
make[2]: *** [lexer.lo] 错误 1
make[2]: Leaving directory `/data/tar_dir/ganglia3.4.0/confuse-2.6/src‘
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/data/tar_dir/ganglia3.4.0/confuse-2.6‘
make: *** [all] 错误 2
cd src/
vi Makefile #删掉该行
AM_CFLAGS = -Wall -Werror
cd ..
如果出现以上错误再重新make
为了ganglia安装不报错修改lib名称
cd /app/ganglia/confuse/confuse2
mv lib/ lib64/
3、rrdtool的安装(主、从都安装)
安装路径:/app/ganglia/rrdtool/rrdtool2
源码包:rrdtool-1.4.5.tar.gz
步骤:cd /app/ganglia/rrdtool
tar -xvf rrdtool-1.4.5.tar.gz
cd rrdtool-1.4.5
./configure --prefix=/app/ganglia/rrdtool/rrdtool2
make
make install
为了ganglia安装不报错修改lib名称
cd /app/ganglia/rrdtool/rrdtool2
mv lib/ lib64/
apache的安装(只需主安装)
安装路径:cd /app/apache/apache2
源码包:httpd-2.2.21.tar.bz2
步骤:cd /app/apache/
tar -xvf httpd-2.2.21.tar.bz2
cd httpd-2.2.21
./configure --prefix=/app/apache/apache2 --enable-rewrite --enable-so --enable-headers
--enable-expires --with-mpm=worker --enable-mouddules=most --enable-deflate
make
make install
修改配置文件
cd /app/apache/apache2/conf
view httpd.conf
Listen 9090 -------40行监听端口改为未被占用端口
User rmbmon ---------112行用户名
Group rmbmon ---------113行用户所属组
<IfModule dir_module>
DirectoryIndex index.html index.php ------添加支持php
</IfModule>
Wq保存退出
php的安装(只需主安装)
安装路径:cd /app/php/php2
源码包:php-5.4.10.tar.gz
步骤:cd /app/php
tar -xvf php-5.4.10.tar.gz
cd php-5.4.10
./configure --prefix=/app/php/php2
make
make install
测试httpd能否解析php
cd /app/apache/apache2/htdocs
view info.php
<?php
phpinfo();
?>
Wq保存,重启Apache
ganglia安装(主、从都安装)
安装路径:/app/ganglia/ganglia2
源码包:ganglia-3.6.0.tar.gz
步骤:cd /app/ganglia
tar -xvf ganglia-3.6.0.tar.gz
cd ganglia-3.6.0
./configure --prefix=/data/software/Ganglia_3.4.0/ganglia --with-static-modules --enable-gexec --enable-status --with-gmetad --with-librrd=/app/ganglia/rrdtool/rrdtool2 --with-libconfuse=/app/ganglia/confuse/confuse2 --with-python=/app/ganglia/python
make
make install
配置文件gmetad.conf的修改(只需要该主)
view /app/ganglia/ganglia2/gmetad.conf
data_source "hadoop cluster" 22.241.7.100 22.241.7.99 ---44行修改集群名称、加入所有节点ip
gridname "rmbmon" -----72行配置网格名称
setuid_username "rmbmon" ------102行配置用户
xml_port 8651 ----112行去#
interactive_port 8652 ----118行去#
rrd_rootdir "/app/ganglia/tmp_data/rrds" -----128行数据存放目录(自己建目录)
配置文件gmond.conf的修改(主、从都更改)
cd /app/ganglia/ganglia2/sbin
./gmond -t > /app/ganglia/ganglia2
view /app/ganglia/ganglia2/gmond.conf
user = rmbmon ---6行配置用户
name = "hadoop cluster" ---30行集群名称
owner = "rmbmon" ------31配置用户
# mcast_join = 22.241.7.100 -----50行加#
host = 22.241.7.100 ----手动加入主机名
gweb安装(只需要该主)
安装路径:/app/ganglia
源码包:ganglia-web-3.7.2.tar.gz
步骤:cd /app/ganglia
tar -xvf ganglia-web-3.7.2.tar.gz
cp -r ganglia-web-3.7.2 /app/apache/apache2/htdocs/
cd /app/apache/apache2/htdocs/
mv ganglia-web-3.7.2 ganglia ---重命名
cd ganglia/
mkdir -pv /app/apache/apache2/htdocs/ganglia/dwoo/cache
mkdir -pv /app/apache/apache2/htdocs/ganglia/dwoo/compiled
配置gweb:
cd /app/apache/apache2/htdocs/ganglia
cp conf_default.php conf.php
view conf.php
$conf[‘gweb_root‘] = dirname(__FILE__); --12行
$conf[‘gweb_confdir‘] = "/app/apache/apache2/htdocs/ganglia"; --13行
$conf[‘gmetad_root‘] = "/app/ganglia/tmp_data/ganglia"; ---37行(自建)
$conf[‘rrds‘] = "/app/ganglia/tmp_data/rrds"; -----38行(自建)
$conf[‘cluster_hide_down_hosts‘] = false; ----189行true改为false
启动Apache
cd /app/apache/apache2/bin
./apachectl start 启动Apache
cd /app/ganglia/ganglia2/sbin
./gmond start
./gmetad start ---先启动gmond 再启动gmetad
从节点只需要启动gmond