Installation of Ganglia

Ganglia is an open source cluster monitoring project from UC Berkeley designed to measure thousands of nodes. The core of Ganglia consists of gmond, gmetad and a web front end. It is mainly used to monitor system performance, such as: cpu, mem, hard disk utilization, I/O load, network traffic, etc. It is easy to see the working status of each node through the curve, and to reasonably adjust and allocate system resources, improve The overall performance of the system plays an important role.

 

The installation of Ganglia can be carried out using yum and rpm. For the newly installed system, you need to execute the following commands respectively to complete the initial installation:

Java code copy code  Favorite code
  1. yum install –y wget 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 rrdtool*  
  2.   
  3. rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  
  4. rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  
  5.  rpm -ivh http://github.com/downloads/jmxtrans/jmxtrans/jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm  
  6.   
  7. yum install ganglia*  
yum install –y wget 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 rrdtool*

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 rpm -ivh http://github.com/downloads/jmxtrans/jmxtrans/jmxtrans-20121016.145842.6a28c97fbb-0.noarch.rpm

yum install ganglia*


Once installed, you can configure it.

1. Modify the conf configuration of ganglia,
    modify /etc/ganglia/gmetad.conf, the data source configuration
    data_source "solr cluster" 127.0.0.1
cluster IP, you can set multiple IP addresses, you can also set multiple data sources.


2. Modify the configuration of /etc/ganglia/gmond.conf and match the name to
cluster {
  name = "solr cluster"
  owner = "unspecified"
  latlong = "unspecified"
  url = "unspecified"
}
3. Modify /etc/httpd/ conf.d/ganglia.conf, Apache configuration, does not intercept ganglia packets
  Alias ​​/ganglia /usr/share/ganglia

  <Location /ganglia>
    Order deny,allow
    Allow from all
    Allow from 192.168.46.21
    Allow from ::1
    # Allow from .example.com
  </Location>



配置jmxtrans
添加solr.json

solr.json的配置如下:

Java代码 copy code  Favorite code
  1. {  
  2.     "servers" : [  
  3.     {  
  4.         "host" : "192.168.46.23",  
  5.         "alias" : "solr23",  
  6.         "port" : "3000",  
  7.         "queries" : [  
  8.         {  
  9.             "obj" : "java.lang:type=Memory",  
  10.             "resultAlias""solr23.heap",  
  11.             "attr" : [ "HeapMemoryUsage""NonHeapMemoryUsage" ],  
  12.             "outputWriters" : [  
  13.              {  
  14.                  "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  15.                  "settings" : {  
  16.                      "groupName" : "Solr-JVM",  
  17.                      "host" : "239.2.11.71",  
  18.                      "port" : "8649"  
  19.                  }  
  20.              }]  
  21.         },  
  22.         {  
  23.             "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",  
  24.             "resultAlias""solr23.cmsoldgen",  
  25.             "attr" : [ "Usage" ],  
  26.             "outputWriters" : [  
  27.              {  
  28.                  "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  29.                  "settings" : {  
  30.                      "groupName" : "Solr-JVM",  
  31.                      "host" : "239.2.11.71",  
  32.                      "port" : "8649"  
  33.                  }  
  34.              }]  
  35.         },  
  36.         {  
  37.             "obj" : "java.lang:type=GarbageCollector,name=*",  
  38.             "resultAlias""solr23.gc",  
  39.             "attr" : [ "CollectionCount""CollectionTime" ],   
  40.             "outputWriters" : [  
  41.              {  
  42.                  "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  43.                  "settings" : {  
  44.                      "groupName" : "Solr-JVM",  
  45.                      "host" : "239.2.11.71",  
  46.                      "port" : "8649"  
  47.                  }  
  48.              }]  
  49.         },  
  50.         {  
  51.             "obj" : "java.lang:type=Threading",  
  52.             "resultAlias""solr23.threads",  
  53.             "attr" : [ "DaemonThreadCount""PeakThreadCount""ThreadCount""TotalStartedThreadCount" ],  
  54.             "outputWriters" : [  
  55.              {  
  56.                  "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  57.                  "settings" : {  
  58.                      "groupName" : "Solr-JVM",  
  59.                      "host" : "239.2.11.71",  
  60.                      "port" : "8649"  
  61.                  }  
  62.              }]  
  63.         },  
  64.         {  
  65.             "obj" : "solr/collection1:type=queryResultCache,id=org.apache.solr.search.LRUCache",  
  66.             "resultAlias""solr23.queryCache",  
  67.             "attr" : [ "warmupTime","size","lookups","evictions","hits","hitratio","inserts","cumulative_lookups","cumulative_hits","cumulative_hits","cumulative_hitratio","cumulative_inserts","cumulative_evictions" ],  
  68.             "outputWriters" : [  
  69.             {  
  70.                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  71.                 "settings" : {  
  72.                     "groupName" : "Solr-JVM",  
  73.                     "host" : "239.2.11.71",  
  74.                     "port" : "8649"  
  75.                 }  
  76.             }]  
  77.         },  
  78.         {  
  79.             "obj" : "solr/collection1:type=searcher,id=org.apache.solr.search.SolrIndexSearcher",  
  80.            "resultAlias""solr23.searcher",  
  81.             "attr" : [ "maxDoc","numDocs","warmupTime" ],  
  82.             "outputWriters" : [  
  83.             {  
  84.                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",  
  85.                 "settings" : {  
  86.                     "groupName" : "Solr-JVM",  
  87.                     "host" : "239.2.11.71",  
  88.                     "port" : "8649"  
  89.                 }  
  90.             }]  
  91.         }]  
  92.     }]  
  93. }  
{
    "servers" : [
    {
        "host" : "192.168.46.23",
        "alias" : "solr23",
        "port" : "3000",
        "queries" : [
        {
            "obj" : "java.lang:type=Memory",
            "resultAlias": "solr23.heap",
            "attr" : [ "HeapMemoryUsage", "NonHeapMemoryUsage" ],
            "outputWriters" : [
             {
                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                 "settings" : {
                     "groupName" : "Solr-JVM",
                     "host" : "239.2.11.71",
                     "port" : "8649"
                 }
             }]
        },
        {
            "obj" : "java.lang:name=CMS Old Gen,type=MemoryPool",
            "resultAlias": "solr23.cmsoldgen",
            "attr" : [ "Usage" ],
            "outputWriters" : [
             {
                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                 "settings" : {
                     "groupName" : "Solr-JVM",
                     "host" : "239.2.11.71",
                     "port" : "8649"
                 }
             }]
        },
        {
            "obj" : "java.lang:type=GarbageCollector,name=*",
            "resultAlias": "solr23.gc",
            "attr" : [ "CollectionCount", "CollectionTime" ], 
            "outputWriters" : [
             {
                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                 "settings" : {
                     "groupName" : "Solr-JVM",
                     "host" : "239.2.11.71",
                     "port" : "8649"
                 }
             }]
        },
        {
            "obj" : "java.lang:type=Threading",
            "resultAlias": "solr23.threads",
            "attr" : [ "DaemonThreadCount", "PeakThreadCount", "ThreadCount", "TotalStartedThreadCount" ],
            "outputWriters" : [
             {
                 "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                 "settings" : {
                     "groupName" : "Solr-JVM",
                     "host" : "239.2.11.71",
                     "port" : "8649"
                 }
             }]
        },
        {
            "obj" : "solr/collection1:type=queryResultCache,id=org.apache.solr.search.LRUCache",
            "resultAlias": "solr23.queryCache",
            "attr" : [ "warmupTime","size","lookups","evictions","hits","hitratio","inserts","cumulative_lookups","cumulative_hits","cumulative_hits","cumulative_hitratio","cumulative_inserts","cumulative_evictions" ],
            "outputWriters" : [
            {
                "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                "settings" : {
                    "groupName" : "Solr-JVM",
                    "host" : "239.2.11.71",
                    "port" : "8649"
                }
            }]
        },
        {
            "obj" : "solr/collection1:type=searcher,id=org.apache.solr.search.SolrIndexSearcher",
           "resultAlias": "solr23.searcher",
            "attr" : [ "maxDoc","numDocs","warmupTime" ],
            "outputWriters" : [
            {
                "@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
                "settings" : {
                    "groupName" : "Solr-JVM",
                    "host" : "239.2.11.71",
                    "port" : "8649"
                }
            }]
        }]
    }]
}





配置完成后,需要依次,启动如下服务:

Java代码 copy code  Favorite code
  1. service httpd start  //启动apache服务  
  2. /etc/init.d/gmetad start   //启动绘图服务  
  3. /etc/init.d/gmond start   //启动数据收集服务  
  4. 这个放在solr前执行  jmx  
  5. /etc/init.d/jmxtrans start  //启动jmx  
  6. /home/solr/start-solr.sh  //启动solr   
service httpd start  //启动apache服务
/etc/init.d/gmetad start   //启动绘图服务
/etc/init.d/gmond start   //启动数据收集服务
这个放在solr前执行  jmx
/etc/init.d/jmxtrans start  //启动jmx
/home/solr/start-solr.sh  //启动solr 


注意,solr启动的jetty的jar需要加上JMX的监控参数,内容如下:

Java代码 copy code  Favorite code
  1. java -Djava.rmi.server.hostname=192.168.46.23    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar start.jar   
java -Djava.rmi.server.hostname=192.168.46.23    -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar start.jar 



最后需要注意一点,为了防止访问apache服务出错,
如果出现:There was an error collecting ganglia data (127.0.0.1:8652): fsockopen error: Permission denied  .  错误,我们需要进行以下的设置:

Java代码 copy code  Favorite code
  1. 1):临时可以使用命令setenforce 0来关闭selinux而不需要重启,刷新页面,即可访问!  
  2. 2):永久的使用,需要关闭selinux:vi /etc/selinux/config,把SELINUX=enforcing改成SELINUX=disable;需要重启机器。  
(1):临时可以使用命令setenforce 0来关闭selinux而不需要重启,刷新页面,即可访问!
(2):永久的使用,需要关闭selinux:vi /etc/selinux/config,把SELINUX=enforcing改成SELINUX=disable;需要重启机器。


After everything is completed, we just access the ip address of our local machine, and the interface we see is as follows:





At this point, our single machine monitors the demo of solr, and the deployment is successful. In the same way, we can also monitor hadoop. , and we can also configure multiple datasources to monitor multiple applications.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326694263&siteId=291194637