ganglia-introduction to installation (2)

 There are two installation methods, online yum installation and download source package compilation and installation. Both installation methods are available, but the online installation version may be older. If you want to use the new version, it is recommended to use offline installation, especially the display of gweb , the old version is ugly.

The package http://yunpan.cn/cZHMtbsGkwLKG   access password 242b is used in the installation process 

1 Environmental preparation before installation

   

  1 Status of the firewall

  1. #Turn off the firewall   
  2.  service iptables stop  
  3.  chkconfig iptables off  
  4. #View status   
  5. service iptables status  

 2 turn off selinux

   sestatus View running status

   If it is running, edit cat /etc/selinux/config 

   Modify the property SELINUX=disabled and restart.

   The above is a permanent method, and the other is to take effect immediately. Run getenforce 0 (I did not run successfully)

   3 Description of related configuration files

   ganglia configuration file directory: /etc/ganglia

   rrd database storage directory: /var/lib/ganglia/rrds

   httpd main site directory: /var/www/html

   ganglia-web installation directory: /usr/share/ganglia

   ganglia-web configuration directory: /etc/httpd/conf.d/ganglia.conf

 

2 yum or apt-get installation

    

      Since my machine is Centos6.5, I only introduce the yum installation method here. The apt-get installation is similar to this, but the command is different.

     1 Check if ganglia related packages exist

       rpm -qa |grep ganglia

      

      I already have it here, it's version 3.1.7

     If not, please run the code below to update the resource

      rpm -Uvh http://dl.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

        

     2  Install gmond (to be installed on each node)

        

     On each node that needs to be monitored, install gmond

     yum install ganglia-gmond

   

     Configure /etc/ganglia/gmond.conf file

     vim /etc/ganglia/gmond.conf

   

     The modification of the Global area is as shown below , only need to modify the user and send_metadata_interval

       

    The Cluster area is modified as shown in the figure below , and the name is modified. This is the cluster name, which is used for the configuration of gmetad later.

       

    The Udp_send_channel area is modified as follows , comment out mcasy_jion (for multicast), we use unicast here, replace 10.3.1.35 with the name of your machine

     

   Udp_recv_channel is modified as follows, just comment out mcast_join and bind

   

   start gmond

     service gmond start

  Note:

You can run telnet localhost 8649    before starting

   If the following figure appears, the xml content is installed correctly, and then install it down

   You can also change the debug in gmond.conf from 0 to 100, see more logs, and then troubleshoot.

    

 

    3 Install gmetad (only required by the master node)

    Install yum install ganglia-gmetad

    configure 

    vim /etc/ganglia/gmetad.conf

   Find the data_source, the first parameter hadoop-cluster and the name of the cluster in gmond.conf must be the same, the second parameter is the same as the host in upd_send_channel, of course there can be many, I have configured one here, combined with the environment you configured.

        

   start up

    service gmetad start

  The test telnet localhost 8651 is the same as the test gmond above, then the installation is successful.

   4 Install gweb (only the master node is required)

   Install yum install ganglia-web

   Modify the access rights of ganglia-web (just drop others, add Allow from all)

   vim /etc/httpd/conf.d/ganglia.conf 

 

[plain] view plain copy

 

  1.  Alias /ganglia /usr/share/ganglia  
  2.  <Location /ganglia>  
  3.  Order deny,allow  
  4. # Deny from all  
  5. # Allow from 127.0.0.1  
  6. # Allow from ::1  
  7.  Allow from all  
  8. # Allow from .example.com  
  9. </Location>  

 

 

    5 Install apache server and php (only the main node installation is required below)

    1) Install apache and php

    yum install httpd php

    2) Install ganglia-web

    yum install ganglia-web

    3) Link the ganglia-web installation directory to the httpd main site directory (the root directory accessed by the apache server)

    ln -s / usr / share / ganglia / var / www / html

    4) Modify the access permissions of the ganglia site directory under the httpd main site directory   

      Change the access permissions of the ganglia site directory to apache:apache, otherwise an error will be reported

      $ chown -R apache:apache /var/www/html/ganglia

      $ chmod -R 755 / var / www / html / ganglia

    5) Modify the access permissions of the rrd database storage directory

      Change the access permissions of the rrd database storage directory to nobody:nobody, otherwise an error will be reported

      chown -R nobody:nobody /var/lib/ganglia/rrds

 6 Initiate access

   Start gmond, gmetad, httpd in sequence

   service gmond start  

   Just access hostname/ganglia (the hostname here is the hostname or ip where gweb and gmetad are installed)

 

3 Source package installation

 

 1 Preparation before installation

 

[plain] view plain copy

 

  1. yum -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  libart_lgpl  libpng  

 

 

 2 Install expat

    download expat-2.0.1.tar.gz

 

[plain] view plain copy

 

  1. tar -xzvf expat-2.0.1.tar.gz  
  2. ./configure --prefix=/usr/local/expat  
  3. make  
  4. make install  

 

    For 64-bit operating systems, you need to manually copy the dynamic link library to lib64 

 

[plain] view plain copy

 

  1. mkdir /usr/local/expat/lib64   
  2. cp -a /usr/local/expat/lib/* /usr/local/expat/lib64/  

 

 

 3 Install apr and apr-util  

 

[plain] view plain copy

 

  1. tar -xvzf apr-1.3.12.tar.gz  
  2. ./configure --prefix=/usr/local/apr   
  3. make   
  4. make install   
  5. tar xvjf apr-util-1.3.12.tar.bz2  
  6. ./configure  --with-apr=/usr/local/apr --with-expat=/usr/local/expat  
  7. make   
  8. make install   

 

    The same 64-bit machine needs to copy the dynamic link library 

 

[plain] view plain copy

 

  1. cp   /usr/local/apr/include/apr-1/* /usr/local/apr/include/   
  2. mkdir -p /usr/local/apr/lib64   
  3. cp -af  /usr/local/apr/lib/* /usr/local/apr/lib64  

 

 

 4 Install confuse 

 

[plain] view plain copy

 

  1. wget http://download.savannah.gnu.org/releases/confuse/confuse-2.7.tar.gz  
  2. tar -xzvf  confuse-2.7.tar.gz  
  3. cd  confuse-2.7   
  4. ./configure CFLAGS=-fPIC --disable-nls --prefix=/usr/local/confuse  
  5. make  
  6. make  install  

 

 

 5 Install rrdtool

 

[plain] view plain copy

 

  1. wget  http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.8.tar.gz  
  2. cd rrdtool-1.4.8  
  3. ./configure --prefix=/usr/local/rrdtool  
  4. make  
  5. make install  

 

  then run 

  /usr/local/rrdtool/bin/rrdtool

  can be seen

   

 6 Install ganglia

     1) Now is the beginning of installing ganglia, if prompted to need pcre

 yum install pcre 

     2) Download ganglia-3.2.6, unzip, install  

 

[plain] view plain copy

 

  1. tar -xzvf ganglia-3.2.6.tar.gz  
  2. ./configure --with-librrd=/usr/local/rrdtool --with-gmetad --prefix=/usr/local/ganglia --with-    libconfuse=/usr/local/confuse --enable-gexec   

 

 

    If it appears as shown in the figure below, it is correct

       

    If not, check the error conditions below:

   Problems that arise:

 

   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

 Solution: yum install libconfuse-devel 

 

  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

 Solution: yum install pcre* 

 

 To solve the above problem, run the following command:

  make 

  make install

 7 Configure gmond (since gmond needs to be installed on each machine, it must be installed on each machine)

   Copy the gmond service startup script

   cp /opt/soft_tar/ganglia-3.6.0/gmond/gmond.init  /etc/rc.d/init.d/gmond 

  Create configuration file home directory

   mkdir /etc/ganglia 

  Copy the gmond command to the /usr/sbin directory

   cp -f /usr/local/ganglia/sbin/gmond /usr/sbin/gmond

  Generate gmond service configuration file

  gmond -t | tee //ganglia/gmond.conf  

  Join gmond service

 chkconfig --add gmond

  Configure /etc/ganglia/gmond.conf

 Changed in red

  globals {

  daemonize = yes

  setuid = yes

  user = ganglia // run ganglia user

  debug_level = 0

  max_udp_msg_len = 1472

  mute = no

  deaf = no

  allow_extra_data = yes

  host_dmax = 86400 /*secs. Expires (removes from web interface) hosts in 1 day */

  host_tmax = 20 /*secs */

  cleanup_threshold = 300 /*secs */

  gexec = no

  send_metadata_interval = 15 /* how many seconds to send once */

}

cluster {

  name = "mycluster"//Cluster name, consistent with the name of gmetad.conf

  owner = "unspecified"//Cluster user name

  latlong = "unspecified"

  url = "unspecified"

}

host {

  location = "unspecified"

}

udp_send_channel {

#mcast_join = 239.2.11.71//Comment out with unicast

  host = 10.2.1.35//gmetad machine

  port = 8649

  ttl = 1

}

udp_recv_channel {

  #mcast_join = 239.2.11.71

  port = 8649

  #bind = 239.2.11.71

  retry_bind = true

}

 start gmond

  Run service gmond start to start gmond

  出现'/usr/local/ganglia/etc/gmond.conf' not found

  solve

   ln -s /etc/ganglia/gmond.conf /usr/local/ganglia/etc/gmond.conf

  or gmond --default_config > /etc/ganglia/gmond.conf

   Restart gmond: service gmond restart. 

  Test Data

  Run tcpdump -i eth0 udp port 8649 on the gmetad machine, or telnet localhost 8649

   

8 Install and configure gmetad

 

[plain] view plain copy

 

  1. 1) The same configuration environment as above  
  2.      cp gmetad/gmetad.Init /etc/rc.d/Init.d/gmetad //Copy the gmetad service startup script  
  3.      mkdir /etc/ganglia //Create configuration file home directory  
  4.      cp gmetad/gmetad.conf /etc/ganglia/ //Copy gmetad service configuration file  
  5.      mkdir -p /var/lib/ganglia/rrds //Create rrd file storage directory  
  6.      cp -f /usr/local/ganglia/sbin/gmetad /usr/sbin/gmetad  
  7.      chkconfig --add gmetad  
  8.      chown nobody:nobody /var/lib/ganglia/rrds //The owner and group are nobody  
  9.      chkconfig --add gmetad      
  10.     cp /opt/soft_tar/ganglia-3.6.0/gmetad/gmetad.conf  /etc/ganglia/  
  11.   2) Configure gmetad.conf     
  12.    data_source "mycluster" 10.2.1.80  
  13.   3) Start gmetad  
  14.     service gmetad start  
  15.     You can run telnet localhost 8651 to see if it starts normally  


 9 Install php and apache

 

 PHP programs need to rely on Apache to run, so you need to install the following dependencies

 1) Install

  yum -y install php httpd

 2) start

  service httpd start //Start httpd service

  3) test php

  vi /var/www/html/index.php

   enter:

  <?php

  phpinfo();

  ?>

  Save, then browser master/index.php  

 10 Install ganglia-web

  download, unzip

       wget http://jaist.dl.sourceforge.net/project/ganglia/ganglia-web/3.6.2/ganglia-web-3.6.2.tar.gz

 decompress

  cd ganglia-web-3.6.2

  vim Makefile source file

       

Modify as follows

       

  execute make install

  Finally in the /var/www/html/ganglia folder,

   cp conf_default.php  conf.php

   vim conf.php, modify

       

    This is modified to the bin path of the locally installed rrdtool 

 11 Modify the permissions of the rrds path

chown  -R nobody:nobody /var/lib/ganglia/rrds

chmod -R 755 / var / lib / ganglia / rrds 

 12 Start gmond gmetad httpd to access

 

 

4 Integrate hadoop, hbase into ganglia

  1 Configure hadoop

   Comment out all the original ones in ${HADOOP_HOME}/etc/hadoop/hadoop-metrics2.properties  , add the following, and restart 

 

[plain] view plain copy

 

  1. *.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31  
  2. *.sink.ganglia.period=10  
  3. *.sink.ganglia.slope=jvm.metrics.gcCount=zero,jvm.metrics.memHeapUsedM=both  
  4. *.sink.ganglia.dmax=jvm.metrics.threadsBlocked=70,jvm.metrics.memHeapUsedM=40  
  5. namenode.sink.ganglia.servers=server-35:8649  
  6. resourcemanager.sink.ganglia.servers=server-35:8649  
  7. datanode.sink.ganglia.servers=server-35:8649  
  8. nodemanager.sink.ganglia.servers=server-35:8649  
  9. maptask.sink.ganglia.servers=server-35:8649  
  10. reducetask.sink.ganglia.servers=server-35:8649  

 

2 Configure Hbase

Comment out all the original ones in ${HADOOP_HOME}/etc/hadoop/hadoop-metrics2-hbase.properties  , add the following, and restart 

 

[plain] view plain copy

 

  1. .sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31  
  2. *.sink.ganglia.period=10  
  3. hbase.sink.ganglia.period=10  
  4. hbase.sink.ganglia.servers=server-35:8649  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325904990&siteId=291194637