注:建议使用超级用户安装
#yum install –y gcc gcc-c++ libpng freetype zlib libdbi apr* libxml2-devel pkg-config glib pixman \
pango pango-devel freetye-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel pcre* rrdtool*
#yum install –y gcc gcc-c++ libpng freetype zlib libdbi apr* libxml2-devel pkg-config glib pixman pango pango-devel freetye-devel fontconfig cairo cairo-devel libart_lgpl libart_lgpl-devel pcre* rrdtool*三、安装expat依赖
#cd /home/aaron
#wget
#tar -xf expat-2.1.0.tar.gz
#cd expat-2.1.0
#./configure --prefix=/usr/local/expat
#make
#make install
#cd /home/aaron #wget #tar -xf expat-2.1.0.tar.gz #cd expat-2.1.0 #./configure --prefix=/usr/local/expat #make #make install对于64位操作系统,需要手动的拷贝下动态链接库到lib64下
#mkdir /usr/local/expat/lib64
#cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/
#mkdir /usr/local/expat/lib64 #cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/四、安装confuse
#cd /home/aaron
#wget
#tar -xf confuse-2.7.tar.gz
#cd confuse-2.7
#./configure CFLAGS=-fPIC --disable-nls --prefix=/usr/local/confuse
#make
#make install
#cd /home/aaron #wget #tar -xf confuse-2.7.tar.gz #cd confuse-2.7 #./configure CFLAGS=-fPIC --disable-nls --prefix=/usr/local/confuse #make #make install64bit机器需要拷贝动态链接库:
#mkdir -p /usr/local/confuse/lib64
#cp -a -f /usr/local/confuse/lib/* /usr/local/confuse/lib64/
#mkdir -p /usr/local/confuse/lib64 #cp -a -f /usr/local/confuse/lib/* /usr/local/confuse/lib64/五、安装ganglia
#cd /home/aaron
#wget %20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz
#tar -xf ganglia-3.6.0.tar.gz
#cd ganglia-3.6.0
#./configure --with-gmetad --enable-gexec --with-libconfuse=/usr/local/confuse --with-libexpat=/usr/local/expat --prefix=/usr/local/ganglia --sysconfdir=/etc/ganglia
#make
#make install
#cd /home/aaron #wget %20monitoring%20core/3.6.0/ganglia-3.6.0.tar.gz #tar -xf ganglia-3.6.0.tar.gz #cd ganglia-3.6.0 #./configure --with-gmetad --enable-gexec --with-libconfuse=/usr/local/confuse --with-libexpat=/usr/local/expat --prefix=/usr/local/ganglia --sysconfdir=/etc/ganglia #make #make install六、服务端配置
创建rrdtool数据目录,看$ganglia-3.2.0/web/conf.php里面的gmetad_root变量,并根据apache的运行用户创建权限,例如apache运行于apache用户上 。
#mkdir -p /var/lib/ganglia/rrds
#mkdir -p /var/lib/ganglia/dwoo
#chown -R root:root /var/lib/ganglia
#mkdir -p /var/lib/ganglia/rrds #mkdir -p /var/lib/ganglia/dwoo #chown -R root:root /var/lib/ganglia配置一个数据源,修改/etc/ganglia/gmetad.conf文件,同时将运行用户设置为rrdtool的目录权限用户,例如apache用户
data_source "Hadoop" 192.168.1.108:8649
setuid_username "root"
data_source "hadoop" 192.168.1.108:8649 setuid_username "root"说明:这里的 " hadoop " 表示的是集群的名称,后面的内容是这个集群中所包含的主机信息,也就是要监控的主机ip。
添加自启动脚本
#cp -f gmetad/gmetad.init /etc/init.d/gmetad
#cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad
#chkconfig --add gmetad
#cp -f gmetad/gmetad.init /etc/init.d/gmetad #cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad #chkconfig --add gmetad启动gmetad服务
#service gmetad start
#service gmetad start看见Starting GANGLIA gmetad: [ OK ]就代表运行正常了。 通过telnet localhost 8651验证gmetad是否正常
七、客户端配置(gmond节点)
本机安装如下:
#cp -f gmond/gmond.init /etc/init.d/gmond
#cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond
#chkconfig --add gmond
#gmond --default_config > /etc/ganglia/gmond.conf
#cp -f gmond/gmond.init /etc/init.d/gmond #cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond #chkconfig --add gmond #gmond --default_config > /etc/ganglia/gmond.conf对于生成的默认配置文件需要做适当的修改
globals {
daemonize = yes
setuid = yes
user = root /*运行Ganglia的用户*/
debug_level = 0
max_udp_msg_len = 1472
mute = no
deaf = no
host_dmax = 120 /*secs */
cleanup_threshold = 300 /*secs */
gexec = no
send_metadata_interval = 15 /*发送数据的时间间隔*/
}
cluster {
name = "hadoop" /*集群名称*/
owner = "root" /*运行Ganglia的用户*/
latlong = "unspecified"
url = "unspecified"
}
udp_send_channel {
# mcast_join = 239.2.11.71 /*注释掉组播*/
host = 192.168.1.108/*发送给安装gmetad的机器*/
port = 8649
ttl = 1
}
udp_recv_channel { #接受UDP包配置
# mcast_join = 239.2.11.71
port = 8649
# bind = 239.2.11.71
}
globals { daemonize = yes setuid = yes user = root /*运行Ganglia的用户*/ debug_level = 0 max_udp_msg_len = 1472 mute = no deaf = no host_dmax = 120 /*secs */ cleanup_threshold = 300 /*secs */ gexec = no send_metadata_interval = 15 /*发送数据的时间间隔*/ } cluster { name = "hadoop" /*集群名称*/ owner = "root" /*运行Ganglia的用户*/ latlong = "unspecified" url = "unspecified" } udp_send_channel { # mcast_join = 239.2.11.71 /*注释掉组播*/ host = 192.168.1.108/*发送给安装gmetad的机器*/ port = 8649 ttl = 1 } udp_recv_channel { #接受UDP包配置 # mcast_join = 239.2.11.71 port = 8649 # bind = 239.2.11.71 }其中name是将要在服务端进行的分组,是服务端的数据源。接下来开启服务
#service gmond start
#service gmond start看见Starting GANGLIA gmetad: [ OK ]代表启动成功。如果有失败,可以讲gmond.conf中的debug从0改为100,看更多的日志,然后进行排查。
相关阅读:
Ubuntu 13.04上搭建Hadoop环境
Ubuntu 12.10 +Hadoop 1.2.1版本集群配置
搭建Hadoop环境(在Winodws环境下用虚拟机虚拟两个Ubuntu系统进行搭建)