Ganglia安装文档1.前期准备1.1.节点准备修改主机名、ip、iptables关闭;时间同步:ntpdate-stime.windows.com;1.2.软件准备ganglia-3.7.1.tar.gz、ganglia-web-3.7.0.tar.gz地址:=66confuse-2.7.tar.gz地址:地址:地址:地址:集群规划2.1.集群信息cat/etc/issue主机名称ip系统版本作用crxy155.crxy192.168.1.155CentOS6.5x86_64监控服务主节点crxy156.crxy192.168.1.156CentOS6.5x86_64监控服务从节点crxy162.crxy192.168.1.162CentOS6.5x86_64监控服务从节点2.2.软件规划Ganglia监控服务的主节点需要安装:ganglia、ganglia-web、php、apacheGanglia被监控从节点需要安装:ganglia2.3.安装路径ganglia-core安装路径/usr/local/gangliaphp安装路径/usr/local/phpapache安装路径/usr/local/apache2ganglia-web安装路径/opt/ganglia/ganglia-webrrds数据路径/opt/ganglia/rrds3.安装框架3.1.检查依赖[或者安装过程中发现缺少再安装]rpm-qgccglibcglibc-commonrrdtoolrrdtool-develexpatexpat-develpcrepcre-develdejavu-lgc-sans-mono-fontsdejavu-sans-mono-fontszlib-develpcrepcre-develaprapr-develapr-utilapr-util-develyum安装:yuminstallgccglibcglibc-commonrrdtoolrrdtool-develexpatexpat-develdejavu-lgc-sans-mono-fontsdejavu-sans-mono-fontszlib-develpcrepcre-develaprapr-develapr-utilapr-util-develyuminstallperllibxml2libxml2-devel//pcre(PerlCompatibleRegularExpressions)正则表达式处理//aprApache可移植运行库3.2.安装ganglia将要安装的源文件传到一个节点的/opt/src下cd/opt/src3.2.1.confuse//libconfuse是一个用C实现配置文件解析器库tarzvxfconfuse-2.7.tar.gzcdconfuse-2.7./configureCFLAGS=-fPIC--disable-nls//-fPIC作用于编译阶段,告诉编译器产生与位置无关代码(Position-IndependentCode)则产生的代码中,没有绝对地址,全部使用相对地址,故而代码可以被加载器加载到内存的任意位置,都可以正确的执行。这正是共享库所要求的,共享库被加载时,在内存的位置不是固定的。//--disable-nls:禁止对国际化支持make&&makeinstall3.2.2.python//ganglia-gmond-modules-python//很慢python[默认的python.so路径/usr/lib64/]cd/opt/srctar-zvxfPython-2.7.10.tgzcd/opt/src/Python-2.7.10./configure--prefix=/usr/local--enable-sharedmake&&makeinstall//安装后libpython2.7.so在/usr/local/lib下配置共享库vi/etc/ld.so.conf--增加如下内容#python.so所在位置/usr/local/lib启用配置ldconfig//ldconfig命令的用途,主要是在默认搜寻目录(/lib和/usr/lib)以及动态库配置文件/etc/ld.so.conf内所列的目录下,搜索出可共享的动态链接库(格式如前介绍,lib*.so*),检查是否生效ldconfig-v|greplibpython2.7.so3.2.3.ganglia3.2.3.1.安装#cd/opt/src#tarzvxfganglia-3.7.1.tar.gz#cdganglia-3.7.1#./configure--prefix=/usr/local/ganglia--with-gmetad--enable-gexec--with-python=/usr/local#make&&makeinstall3.2.3.2.配置gmond(所有节点)cd/opt/src/ganglia-3.7.1//初始化gmond配置文件./gmond/gmond-t/usr/local/ganglia/etc/gmond.confvi/usr/local/ganglia/etc/gmond.conf--修改如下内容cluster{name=cloud-clusterowner=nobodylatlong=unspecifiedurl=unspecified}udp_send_channel{#bind_hostname=yes#Highlyrecommended,soontobedefault.#Thisoptiontellsgmondtouseasourceaddress#thatresolvestothemachine'shostname.Without#this,themetricsmayappeartocomefromany#interfaceandtheDNSnamesassociatedwith#thoseIPswillbeusedtocreatetheRRDs.mcast_join=239.2.11.71port=8649ttl=1}/*Youcanspecifyasmanyudp_recv_channelsasyoulikeaswell.*/udp_recv_channel{mcast_join=239.2.11.71port=8649bind=239.2.11.71retry_bind=true#SizeoftheUDPbuffer.Ifyouarehandlinglotsofmetricsyoureally#shouldbumpituptoe.g.10MBorevenhigher.#buffer=10485760}#########################################添加python指标Begin复制pythonmodule到ganglia部署目录mkdir/usr/local/ganglia/lib64/ganglia/python_modulescd/opt/src/ganglia-3.7.1cp./gmond/python_modules/*/*.py/usr/local/ganglia/lib64/ganglia/python_modules安装程序ganglia-3.7.1默认提供了一些pythonmodule的配置文件,只需要部署到/usr/local/ganglia/etc/conf.d目录下面即可生效cp./gmond/python_modules/conf.d/*.pyconf/usr/local/ganglia/etc/conf.d#####为什么创建python_modules和复制到指定文件夹?约定由于配置,查看/usr/local/ganglia/etc/conf.d/modpython.conf#########################################添加python指标End同步【ganglia、gmond配置、python模块】其他节点scp-r/usr/local/lib/libpython2.7.so*root@crxy156.crxy:/usr/local/libscp-r/usr/local/lib/python2.7/root@crxy156.crxy:/usr/local/lib/scp/etc/ld.so.confroot@crxy156.crxy:/etc/ld.so.confscp-r/usr/local/ganglia/root@crxy156.crxy:/usr/local/ganglia/scp-r/etc/init.d/gmondroot@crxy156.crxy:/etc/init.d/gmondscp-r/usr/local/ganglia/root@crxy162.crxy:/usr/local/ganglia/scp-r/etc/init.d/gmondroot@crxy162.crxy:/etc/init.d/gmond启动gmond服务,并设为开机自动运行#sshroot@crxy155.crxy'cmd'sshroot@crxy156.crxy'ldconfig-v|greppython2.7'//添加开机启动cd/opt/src/ganglia-3.7.1cp./gmond/gmond.init/etc/init.d/gmondvi/etc/init.d/gmond--修改如下内容GMOND=/usr/local/ganglia/sbin/gmondchkconfig--addgmond开启服务:servicegmondstart/restart在gmond机器上测试telnetlocalhost86493.2.3.3.配置gmetad(主节点)cd/opt/src/ganglia-3.7.1vi/usr/local/ganglia/etc/gmetad.conf--修改如下内容##如果此文件没有cp./gmetad/gmetad.conf/usr/local/ganglia/etc/--从第一台响应主机开始收集状态数据data_sourcecloud-cluster10crxy155.crxycrxy156.crxycrxy162.crxygridnamecloud-grid--gmetad侦听端口xml_port8651--gmetad交互式侦听端口interactive_port8652rrd_rootdir/opt/ganglia/rrdscase_sensitive_hostnames0创建和修改rrds数据目录所有者mkdir-p/opt/ganglia/rrdschown-Rnobody:nobody/opt/ganglia/rrds启动gmetad服务servicegmetadrestart##设置开机启动cd/opt/src/ganglia-3.7.1cp./gmetad/gmetad.init/etc/init.d/gmetadvi/etc/init.d/gmetad修改如下内容GMETAD=/usr/local/ganglia/sbin/gmetadchkconfig--addgmetad在gmetad机器上测试telnetlocalhost86513.2.3.4.安装ganglia-web(主节点)3.2.3.