Build a ganglia cluster and monitor hadoopCDH4.6

Source: Internet
Author: User

• Host Name
• IP
• OS
• Arch
 
• Master
• 192.168.1.201
• CentOS 6.4
• X86_64
 
• Slave1
• 192.168.1.202
• CentOS 6.4
• X86_64
 
• Slave2
• 192.168.1.203
• CentOS 6.4
• X86_64
 
• Item
• Value
 
• Monitoring Service master node
• Master
 
• Slave node monitored
• Slave1
• Slave2

• Preface
• Recently, ganglia has been working on cloud monitoring tools, and it seems that ganglia is very bright. It can present data from the perspective of a cluster as a whole. however, the installation process is a little complicated and there are a little more dependencies. Therefore, I would like to share this article with you.
• This article does not explain the relevant principles. If you want to learn more, please refer to other materials.
• Purpose: build your own ganglia monitoring cluster by following the steps in this article, even if you have not previously touched ganglia.
• @ Author duangr
• @ Website http://my.oschina.net/duangr/blog/181585
• 1. Related Environment

• Confirm all hosts:
• Disable iptables
• SELinux disabled
• 2. Deployment planning
• The master node of the Ganglia monitoring service must be installed:
• Ganglia

Ganglia-web

Php

Apache

Install the Ganglia slave node to be monitored:

◦ Ganglia

Installation path planning

Item Value
Ganglia installation path/usr/local/ganglia
Php installation path/usr/local/php
Apache installation path/usr/local/apache2
Ganglia-web installation path/export/home/ganglia-web-3.5.10
Rrds data path/var/lib/ganglia/rrdtool

3. Get code

Ganglia-3.6.0.tar.gz

Ganglia-web-3.5.12.tar.gz

Httpd-2.2.23.tar.gz

Php-5.4.10.tar.gz

4. Prerequisite dependency
4.1 check the host environment (all host nodes)
[Plain] view plaincopyprint?
# Rpm-q gcc glibc-common rrdtool-devel apr-devel expat-devel pcre-devel dejavu-lgc-sans-mono-fonts dejavu-sans-mono- fonts
Gcc-4.4.7-3.el6.x86_64
Glibc-2.14.1-6.x86_64
Glibc-common-2.14.1-6.x86_64
Rrdtool-1.3.8-6.el6.x86_64
Rrdtool-devel-1.3.8-6.el6.x86_64
Apr-1.3.9-5.el6_2.x86_64
Apr-devel-1.3.9-5.el6_2.x86_64
Expat-2.0.1-11.el6_2.x86_64
Expat-devel-2.0.1-11.el6_2.x86_64
Pcre-7.8-6.el6.x86_64
Pcre-devel-7.8-6.el6.x86_64
Dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch.rpm
Dejavu-sans-mono-fonts-2.30-2.el6.noarch.rpm
If there are any missing installation packages, install them first. You can download the relevant installation packages from the following image websites:

Http://rpm.pbone.net/

Http://mirrors.163.com/centos/6.4/ OS /x86_64/Packages/

Http://mirrors.sohu.com/centos/6.4/ OS /x86_64/Packages/

4.2 dejavu

[Plain] view plaincopyprint?
Rpm-ivh dejavu-lgc-sans-mono-fonts-2.30-2.el6.noarch.rpm
Rpm-ivh dejavu-sans-mono-fonts-2.30-2.el6.noarch.rpm

4.3 rrdtool

[Plain] view plaincopyprint?
Rpm-ivh rrdtool-1.3.8-6.el6.x86_64.rpm
Rpm-ivh rrdtool-devel-1.3.8-6.el6.x86_64.rpm

4.4 apr

[Plain] view plaincopyprint?
Rpm-ivh apr-1.3.9-5.el6_2.x86_64.rpm
Rpm-ivh apr-devel-1.3.9-5.el6_2.x86_64.rpm

4.5 libexpat

[Plain] view plaincopyprint?
Rpm-ivh expat-2.0.1-11.el6_2.x86_64.rpm
Rpm-ivh expat-devel-2.0.1-11.el6_2.x86_64.rpm

4.6 libpcre

[Plain] view plaincopyprint?
Rpm-ivh pcre-7.8-6.el6.x86_64.rpm
Rpm-ivh pcre-devel-7.8-6.el6.x86_64.rpm

4.7 confuse
Confuse-2.7 http://www.nongnu.org/confuse/

[Plain] view plaincopyprint?
Tar-zxf confuse-2.7.tar.gz
Cd confuse-2.7
./Configure CFLAGS =-fPIC -- disable-nls
Make & make install
Python 4.8
Python-2.7.3.tar.bz2 http://www.python.org/

[Plain] view plaincopyprint?
Tar-jxf Python-2.7.3.tar.bz2
./Configure -- prefix =/usr/local -- enable-shared
Make & make install
Configure the Shared Library

[Plain] view plaincopyprint?
Vi/etc/ld. so. conf

-- Add the following content:
/Usr/local/lib
Enable Configuration

Ldconfig

Check for effectiveness

Ldconfig-v | grep "libpython2.7.so"

5. Compile and install
5.1 install ganglia (all nodes must be installed)
[Plain] view plaincopyprint?
# Tar-zxf ganglia-3.6.0.tar.gz
# Cd ganglia-3.6.0
#./Configure -- prefix =/usr/local/ganglia -- with-gmetad -- enable-gexec -- with-python =/usr/local
Welcome ..
_________
/____/_____________/(_)____
//__/__'/__\/__'///__'/
//_///_//////_/////_//
\____/\__,_/_//_/\__,/_/_/\__,_/
/____/

Copyright (c) 2005 University of California, Berkeley

Version: 3.6.0
Library: Release 3.6.0 0: 0

Type "make" to compile.
# Make & make install
5.2 install ganglia-web (master node installation)
 

[Plain] view plaincopyprint?
# Tar-zxf ganglia-web-3.5.12.tar.gz-C/export/home/ganglia/
# Cd/export/home/ganglia-web-3.5.12
# Cp conf_default.php conf. php
 

Change vi conf. php to the following content:

[Plain] view plaincopyprint?
$ Conf ['gweb _ confdir'] = "/var/www/html/ganglia ";
$ Conf ['gmetad _ root'] = "/var/www/html ";
Vi header. php

[Plain] view plaincopyprint?
<? Php
Session_start ();
Ini_set ('date. timezone ', 'prc'); -- change the time zone to the local time zone.

If (isset ($ _ GET ['date _ only']) {
$ D = date ("r ");
Echo $ d;
Exit (0 );
}
Configure temporary directory

[Plain] view plaincopyprint?
Cd/var/www/html/ganglia-webpage-3.5.12/dwoo
Mkdir cache
Chmod 777 cache
Mkdir compiled
Chmod 777 compiled
5.3 install apache (master node installation)
[Plain] view plaincopyprint?
Tar-zxf httpd-2.2.23.tar.gz
Cd httpd-2.2.23
./Configure -- prefix =/usr/local/apache2
Make & make install
5.4 install php (master node installation)
[Plain] view plaincopyprint?
Tar-zxf php-5.4.10.tar.gz
Cd php-5.4.10
./Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr
Make & make install

Note: during the actual installation process

[Plain] view plaincopyprint?
Run the yum-y install httpd php Command to install apache httpd and php support, which is simple and convenient.

According to the above installation method, the default site directory configured is/var/www/html/, and a new php script info. php is created:

[Plain] view plaincopyprint?
<? Php
Phpinfo ();
?> If http: // localhost/info. php is successfully accessed, the installation is successful.

5.5 use apache to publish ganglia-web (installed on the master node)
Vi/usr/local/apache2/conf/httpd. conf

[Plain] view plaincopyprint?
....
Listen 80
....

<IfModule dir_module>
DirectoryIndex index.html index. php
AddType application/x-httpd-php. php
</IfModule>
....

# Add the following content at the end of the file:
# Ganglia
Alias/ganglia "/var/www/html/ganglia"
<Directory "/var/www/html/ganglia">
AuthType Basic
Options None
AllowOverride None
Order allow, deny
Allow from all
</Directory>
Start the httpd service

[Plain] view plaincopyprint?
/Usr/local/apache2/bin/apachectl restart
6. Configure Ganglia
6.1 configure gmetad (master node)
[Plain] view plaincopyprint?
Cd ganglia-1, 3.6.0
Cp./gmetad. init/etc/init. d/gmetad
Cp./gmetad. conf/usr/local/ganglia/etc/
Vi/etc/init. d/gmetad -- modify the following content:

[Plain] view plaincopyprint?
GMETAD =/usr/local/ganglia/sbin/gmetad
Vi/usr/local/ganglia/etc/gmetad. conf -- modify the following content:

[Plain] view plaincopyprint?
Data_source "hadoop-cluster" 10 master slave1 slave2
Xml_port 8651
Interactive_ports 8652
Rrd_rootdir "/var/lib/ganglia/rrds"
Case_sensitive_hostnames 0
Modify the rrds data directory owner

[Plain] view plaincopyprint?
Chown-R nobody: nobody/var/lib/ganglia/rrds
Start the gmetad service and set it to automatically run upon startup

[Plain] view plaincopyprint?
Service gmetad restart
Chkconfig -- add gmetad

6.2 configure gmond (all nodes)
[Plain] view plaincopyprint?
Cd ganglia-1, 3.6.0
Cp./gmond. init/etc/init. d/gmond
./Gmond-t>/usr/local/ganglia/etc/gmond. conf
Vi/etc/init. d/gmond -- modify the following content:

[Plain] view plaincopyprint?
GMOND =/usr/local/ganglia/sbin/gmond
Vi/usr/local/ganglia/etc/gmond. conf -- modify the following content:

[Plain] view plaincopyprint?
Cluster {
Name = "hadoop-cluster"
Owner = "nobody"
Latlong = "unspecified"
Url = "unspecified"
}
Copy the python module to the ganglia deployment directory.

[Plain] view plaincopyprint?
Mkdir/usr/local/ganglia/lib64/ganglia/python_modules
Cp./gmond/python_modules/*. py/usr/local/ganglia/lib64/ganglia/python_modules

The installation program ganglia-3.6.0 provides some python module configuration files by default, which only need to be deployed under the/usr/local/ganglia/etc/conf. d directory to take effect.

If you are not concerned about the monitoring scripts provided by default, skip the following steps:

[Plain] view plaincopyprint?
Cp./gmond/python_modules/conf. d/*. pyconf/usr/local/ganglia/etc/conf. d

Start the gmond service and set it to automatically run upon startup

[Plain] view plaincopyprint?
Service gmond restart
Chkconfig -- add gmond
6.3 put ganglia_web under the/var/www/html/directory
Run cp/export/home/ganglia-web-3.5.12/*/var/www/html/ganglia

7. Monitoring page
Http: // 192.168.1.201/ganglia/

8. Integration with CDH4.6
There are many hadoop configuration files in CDH. To integrate ganglia, You need to edit the file hadoop-metrics2.properties and copy the related files from/etc/hadoop/conf. dist to the $ hadoop_conf directory. Cp/etc/hadoop/conf. dist/hadoop-metrics2.properties/etc/hadoop/conf add #
# Below are for sending metrics to Ganglia
#
# For Ganglia 3.0 support
# *. Sink. ganglia. class = org. apache. hadoop. metrics2.sink. ganglia. GangliaSink30
#
# For Ganglia 3.1 support
*. Sink. ganglia. class = org. apache. hadoop. metrics2.sink. ganglia. GangliaSink31
*. Sink. ganglia. period = 10

# Default for supportsparse is false
*. Sink. ganglia. supportsparse = true
*. Sink. ganglia. slope = jvm. metrics. gcCount = zero, jvm. metrics. memHeapUsedM = both
*. Sink. ganglia. dmax = jvm. metrics. threadsBlocked = 70, jvm. metrics. memHeapUsedM = 40
Namenode. sink. ganglia. servers = 239.2.11.71: 8649
Datanode. sink. ganglia. servers = 239.2.11.71: 8649
# Jobtracker. sink. ganglia. servers = 239.2.11.71: 8649
# Tasktracker. sink. ganglia. servers = 239.2.11.71: 8649
Resourcemanager. sink. ganglia. servers = 239.2.11.71: 8649
Nodemanager. sink. ganglia. servers = 239.2.11.71: 8649
Maptask. sink. ganglia. servers = 239.2.11.71: 8649
Reducetask. sink. ganglia. servers = 239.2.11.71: 8649
# Dfs. class = org. apache. hadoop. metrics. spi. NullContextWithUpdateThread
# Add
Dfs. class = org. apache. hadoop. metrics. ganglia. GangliaContext31
Dfs. period = 10
Dfs. servers = 239.2.11.71: 8649

Mapred. class = org. apache. hadoop. metrics. ganglia. GangliaContext31
Mapred. period = 10
Mapred. servers = 239.2.11.71: 8649

# Jvm. class = org. apache. hadoop. metrics. spi. NullContextWithUpdateThread
# Jvm. period = 300

Jvm. class = org. apache. hadoop. metrics. ganglia. GangliaContext31
Jvm. period = 10
Jvm. servers = 239.2.11.71: 8649
The server and port are determined from/usr/local/ganglia/etc/gmond. conf to get/* Feel free to specify as using udp_send_channels as you like. Gmond
Used to only support having a single channel */
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.
# This, the metrics may appear to come from any
# Interface and the DNS names associated
# Those IPs will be used to create the RRDs.
Mcast_join = 239.2.11.71
Port = 8649
Ttl = 1
}
Mcast_join = 239.2.11.71 determines the server address, which is a fixed multicast address used by ganglia to send xml format file information. Port = 8649. In this way, we can restart the hadoop service to view the monitoring screen from the ganglia interface.

Now we have configured ganglia to monitor cdh4.6.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.