forked from apache/zookeeper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzookeeperJMX.html
477 lines (417 loc) · 14.6 KB
/
zookeeperJMX.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="Apache Forrest" name="Generator">
<meta name="Forrest-version" content="0.8">
<meta name="Forrest-skin-name" content="pelt">
<title>ZooKeeper JMX</title>
<link type="text/css" href="skin/basic.css" rel="stylesheet">
<link media="screen" type="text/css" href="skin/screen.css" rel="stylesheet">
<link media="print" type="text/css" href="skin/print.css" rel="stylesheet">
<link type="text/css" href="skin/profile.css" rel="stylesheet">
<script src="skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="skin/fontsize.js" language="javascript" type="text/javascript"></script>
<link rel="shortcut icon" href="images/favicon.ico">
</head>
<body onload="init()">
<script type="text/javascript">ndeSetTextSize();</script>
<div id="top">
<!--+
|breadtrail
+-->
<div class="breadtrail">
<a href="http://www.apache.org/">Apache</a> > <a href="http://hadoop.apache.org/">Hadoop</a> > <a href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a><script src="skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
</div>
<!--+
|header
+-->
<div class="header">
<!--+
|start group logo
+-->
<div class="grouplogo">
<a href="http://hadoop.apache.org/"><img class="logoImage" alt="Hadoop" src="images/hadoop-logo.jpg" title="Apache Hadoop"></a>
</div>
<!--+
|end group logo
+-->
<!--+
|start Project Logo
+-->
<div class="projectlogo">
<a href="http://hadoop.apache.org/zookeeper/"><img class="logoImage" alt="ZooKeeper" src="images/zookeeper_small.gif" title="ZooKeeper: distributed coordination"></a>
</div>
<!--+
|end Project Logo
+-->
<!--+
|start Search
+-->
<div class="searchbox">
<form action="http://www.google.com/search" method="get" class="roundtopsmall">
<input value="hadoop.apache.org" name="sitesearch" type="hidden"><input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
<input name="Search" value="Search" type="submit">
</form>
</div>
<!--+
|end search
+-->
<!--+
|start Tabs
+-->
<ul id="tabs">
<li>
<a class="unselected" href="http://hadoop.apache.org/zookeeper/">Project</a>
</li>
<li>
<a class="unselected" href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
</li>
<li class="current">
<a class="selected" href="index.html">ZooKeeper 3.4 Documentation</a>
</li>
</ul>
<!--+
|end Tabs
+-->
</div>
</div>
<div id="main">
<div id="publishedStrip">
<!--+
|start Subtabs
+-->
<div id="level2tabs"></div>
<!--+
|end Endtabs
+-->
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<!--+
|breadtrail
+-->
<div class="breadtrail">
</div>
<!--+
|start Menu, mainarea
+-->
<!--+
|start Menu
+-->
<div id="menu">
<div onclick="SwitchMenu('menu_1.1', 'skin/')" id="menu_1.1Title" class="menutitle">Overview</div>
<div id="menu_1.1" class="menuitemgroup">
<div class="menuitem">
<a href="index.html">Welcome</a>
</div>
<div class="menuitem">
<a href="zookeeperOver.html">Overview</a>
</div>
<div class="menuitem">
<a href="zookeeperStarted.html">Getting Started</a>
</div>
<div class="menuitem">
<a href="releasenotes.html">Release Notes</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.2', 'skin/')" id="menu_1.2Title" class="menutitle">Developer</div>
<div id="menu_1.2" class="menuitemgroup">
<div class="menuitem">
<a href="api/index.html">API Docs</a>
</div>
<div class="menuitem">
<a href="zookeeperProgrammers.html">Programmer's Guide</a>
</div>
<div class="menuitem">
<a href="javaExample.html">Java Example</a>
</div>
<div class="menuitem">
<a href="zookeeperTutorial.html">Barrier and Queue Tutorial</a>
</div>
<div class="menuitem">
<a href="recipes.html">Recipes</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.3', 'skin/')" id="menu_1.3Title" class="menutitle">BookKeeper</div>
<div id="menu_1.3" class="menuitemgroup">
<div class="menuitem">
<a href="bookkeeperStarted.html">Getting started</a>
</div>
<div class="menuitem">
<a href="bookkeeperOverview.html">Overview</a>
</div>
<div class="menuitem">
<a href="bookkeeperConfig.html">Setup guide</a>
</div>
<div class="menuitem">
<a href="bookkeeperProgrammer.html">Programmer's guide</a>
</div>
</div>
<div onclick="SwitchMenu('menu_selected_1.4', 'skin/')" id="menu_selected_1.4Title" class="menutitle" style="background-image: url('skin/images/chapter_open.gif');">Admin & Ops</div>
<div id="menu_selected_1.4" class="selectedmenuitemgroup" style="display: block;">
<div class="menuitem">
<a href="zookeeperAdmin.html">Administrator's Guide</a>
</div>
<div class="menuitem">
<a href="zookeeperQuotas.html">Quota Guide</a>
</div>
<div class="menupage">
<div class="menupagetitle">JMX</div>
</div>
<div class="menuitem">
<a href="zookeeperObservers.html">Observers Guide</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.5', 'skin/')" id="menu_1.5Title" class="menutitle">Contributor</div>
<div id="menu_1.5" class="menuitemgroup">
<div class="menuitem">
<a href="zookeeperInternals.html">ZooKeeper Internals</a>
</div>
</div>
<div onclick="SwitchMenu('menu_1.6', 'skin/')" id="menu_1.6Title" class="menutitle">Miscellaneous</div>
<div id="menu_1.6" class="menuitemgroup">
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/ZooKeeper">Wiki</a>
</div>
<div class="menuitem">
<a href="http://wiki.apache.org/hadoop/ZooKeeper/FAQ">FAQ</a>
</div>
<div class="menuitem">
<a href="http://hadoop.apache.org/zookeeper/mailing_lists.html">Mailing Lists</a>
</div>
</div>
<div id="credit"></div>
<div id="roundbottom">
<img style="display: none" class="corner" height="15" width="15" alt="" src="skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
<!--+
|alternative credits
+-->
<div id="credit2"></div>
</div>
<!--+
|end Menu
+-->
<!--+
|start content
+-->
<div id="content">
<div title="Portable Document Format" class="pdflink">
<a class="dida" href="zookeeperJMX.pdf"><img alt="PDF -icon" src="skin/images/pdfdoc.gif" class="skin"><br>
PDF</a>
</div>
<h1>ZooKeeper JMX</h1>
<div id="minitoc-area">
<ul class="minitoc">
<li>
<a href="#ch_jmx">JMX</a>
</li>
<li>
<a href="#ch_starting">Starting ZooKeeper with JMX enabled</a>
</li>
<li>
<a href="#ch_console">Run a JMX console</a>
</li>
<li>
<a href="#ch_reference">ZooKeeper MBean Reference</a>
</li>
</ul>
</div>
<a name="N10009"></a><a name="ch_jmx"></a>
<h2 class="h3">JMX</h2>
<div class="section">
<p>Apache ZooKeeper has extensive support for JMX, allowing you
to view and manage a ZooKeeper serving ensemble.</p>
<p>This document assumes that you have basic knowledge of
JMX. See <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/">
Sun JMX Technology</a> page to get started with JMX.
</p>
<p>See the <a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html">
JMX Management Guide</a> for details on setting up local and
remote management of VM instances. By default the included
<em>zkServer.sh</em> supports only local management -
review the linked document to enable support for remote management
(beyond the scope of this document).
</p>
</div>
<a name="N10024"></a><a name="ch_starting"></a>
<h2 class="h3">Starting ZooKeeper with JMX enabled</h2>
<div class="section">
<p>The class
<em>org.apache.zookeeper.server.quorum.QuorumPeerMain</em>
will start a JMX manageable ZooKeeper server. This class
registers the proper MBeans during initalization to support JMX
monitoring and management of the
instance. See <em>bin/zkServer.sh</em> for one
example of starting ZooKeeper using QuorumPeerMain.</p>
</div>
<a name="N10034"></a><a name="ch_console"></a>
<h2 class="h3">Run a JMX console</h2>
<div class="section">
<p>There are a number of JMX consoles available which can connect
to the running server. For this example we will use Sun's
<em>jconsole</em>.</p>
<p>The Java JDK ships with a simple JMX console
named <a href="http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html">jconsole</a>
which can be used to connect to ZooKeeper and inspect a running
server. Once you've started ZooKeeper using QuorumPeerMain
start <em>jconsole</em>, which typically resides in
<em>JDK_HOME/bin/jconsole</em>
</p>
<p>When the "new connection" window is displayed either connect
to local process (if jconsole started on same host as Server) or
use the remote process connection.</p>
<p>By default the "overview" tab for the VM is displayed (this
is a great way to get insight into the VM btw). Select
the "MBeans" tab.</p>
<p>You should now see <em>org.apache.ZooKeeperService</em>
on the left hand side. Expand this item and depending on how you've
started the server you will be able to monitor and manage various
service related features.</p>
<p>Also note that ZooKeeper will register log4j MBeans as
well. In the same section along the left hand side you will see
"log4j". Expand that to manage log4j through JMX. Of particular
interest is the ability to dynamically change the logging levels
used by editing the appender and root thresholds. Log4j MBean
registration can be disabled by passing
<em>-Dzookeeper.jmx.log4j.disable=true</em> to the JVM
when starting ZooKeeper.
</p>
</div>
<a name="N1005F"></a><a name="ch_reference"></a>
<h2 class="h3">ZooKeeper MBean Reference</h2>
<div class="section">
<p>This table details JMX for a server participating in a
replicated ZooKeeper ensemble (ie not standalone). This is the
typical case for a production environment.</p>
<table class="ForrestTable" cellspacing="1" cellpadding="4">
<caption>MBeans, their names and description</caption>
<title>MBeans, their names and description</title>
<tr>
<th>MBean</th>
<th>MBean Object Name</th>
<th>Description</th>
</tr>
<tr>
<td>Quorum</td>
<td>ReplicatedServer_id<#></td>
<td>Represents the Quorum, or Ensemble - parent of all
cluster members. Note that the object name includes the
"myid" of the server (name suffix) that your JMX agent has
connected to.</td>
</tr>
<tr>
<td>LocalPeer|RemotePeer</td>
<td>replica.<#></td>
<td>Represents a local or remote peer (ie server
participating in the ensemble). Note that the object name
includes the "myid" of the server (name suffix).</td>
</tr>
<tr>
<td>LeaderElection</td>
<td>LeaderElection</td>
<td>Represents a ZooKeeper cluster leader election which is
in progress. Provides information about the election, such as
when it started.</td>
</tr>
<tr>
<td>Leader</td>
<td>Leader</td>
<td>Indicates that the parent replica is the leader and
provides attributes/operations for that server. Note that
Leader is a subclass of ZooKeeperServer, so it provides
all of the information normally associated with a
ZooKeeperServer node.</td>
</tr>
<tr>
<td>Follower</td>
<td>Follower</td>
<td>Indicates that the parent replica is a follower and
provides attributes/operations for that server. Note that
Follower is a subclass of ZooKeeperServer, so it provides
all of the information normally associated with a
ZooKeeperServer node.</td>
</tr>
<tr>
<td>DataTree</td>
<td>InMemoryDataTree</td>
<td>Statistics on the in memory znode database, also
operations to access finer (and more computationally
intensive) statistics on the data (such as ephemeral
count). InMemoryDataTrees are children of ZooKeeperServer
nodes.</td>
</tr>
<tr>
<td>ServerCnxn</td>
<td><session_id></td>
<td>Statistics on each client connection, also
operations on those connections (such as
termination). Note the object name is the session id of
the connection in hex form.</td>
</tr>
</table>
<p>This table details JMX for a standalone server. Typically
standalone is only used in development situations.</p>
<table class="ForrestTable" cellspacing="1" cellpadding="4">
<caption>MBeans, their names and description</caption>
<title>MBeans, their names and description</title>
<tr>
<th>MBean</th>
<th>MBean Object Name</th>
<th>Description</th>
</tr>
<tr>
<td>ZooKeeperServer</td>
<td>StandaloneServer_port<#></td>
<td>Statistics on the running server, also operations
to reset these attributes. Note that the object name
includes the client port of the server (name
suffix).</td>
</tr>
<tr>
<td>DataTree</td>
<td>InMemoryDataTree</td>
<td>Statistics on the in memory znode database, also
operations to access finer (and more computationally
intensive) statistics on the data (such as ephemeral
count).</td>
</tr>
<tr>
<td>ServerCnxn</td>
<td><session_id></td>
<td>Statistics on each client connection, also
operations on those connections (such as
termination). Note the object name is the session id of
the connection in hex form.</td>
</tr>
</table>
</div>
<p align="right">
<font size="-2"></font>
</p>
</div>
<!--+
|end content
+-->
<div class="clearboth"> </div>
</div>
<div id="footer">
<!--+
|start bottomstrip
+-->
<div class="lastmodified">
<script type="text/javascript"><!--
document.write("Last Published: " + document.lastModified);
// --></script>
</div>
<div class="copyright">
Copyright ©
2008 <a href="http://www.apache.org/licenses/">The Apache Software Foundation.</a>
</div>
<!--+
|end bottomstrip
+-->
</div>
</body>
</html>