Ganglia 监控 Solr

安装 Ganglia

1
2
3
4
5
6
7
8
9
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*

配置 Ganglia(仅指出必要配置部分)

编辑配置文件:

1
vim /etc/ganglia/gmetad.conf
1
2
3
4
5
data_source "solrcluster" 127.0.0.1 # 运行 gmod 机器的 IP
```

```bash
vim /etc/ganglia/gmond.conf
1
2
3
4
5
6
7
8
9
10
11
cluster {
name = "solrcluster"
owner = "unspecified"
latlong = "unspecified"
url = "unspecified"
}
```
 

```bash
vim /etc/httpd/conf.d/ganglia.conf
1
2
3
4
5
6
7
<Location /ganglia>
Order deny,allow
Allow from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>

配置 Solr 启动参数

必要参数配置:

1
2
# /home/solr/start-solr.sh
java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3000 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=127.0.0.1 -jar start.jar

配置 JMXTrans

配置文件路径:/var/lib/jmxtrans/solr.json

注意: host 的 IP 地址必须与 -Djava.rmi.server.hostname=IP_OR_HOSTNAME 参数指定的 IP 相同

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105

{

"servers" : [
{
"host" : "127.0.0.1",
"alias" : "solr",
"port" : "3000",
"queries" : [
{
"obj" : "java.lang:type=Memory",
"resultAlias": "solr1.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": "solr1.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": "solr1.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": "solr1.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": "solr1.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": "solr1.searcher",
"attr" : [ "maxDoc","numDocs","warmupTime" ],
"outputWriters" : [
{
"@class" : "com.googlecode.jmxtrans.model.output.GangliaWriter",
"settings" : {
"groupName" : "Solr-JVM",
"host" : "239.2.11.71",
"port" : "8649"
}
}
]
}
]
}
]

}

启动服务

注意: JMXTrans 要最后启动

1
2
3
4
5
/etc/init.d/httpd start
/etc/init.d/gmetad start
/etc/init.d/gmond start
/home/solr/start-solr.sh
/etc/init.d/jmxtrans start
© 2025 Solr Community of China All Rights Reserved. 本站访客数人次 本站总访问量
Theme by hiero