Commit cc63f25c authored by Patrick D. Hunt's avatar Patrick D. Hunt
Browse files

ZOOKEEPER-1346. Add Jetty HTTP server support for four letter words. (Skye...

ZOOKEEPER-1346. Add Jetty HTTP server support for four letter words. (Skye Wanderman-Milne, Bill Havanki via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1611516 13f79535-47bb-0310-9956-ffa450edef68
parent 4c643cd3
......@@ -34,6 +34,9 @@ NEW FEATURES:
ZOOKEEPER-827. enable r/o mode in C client library (rgs via fpj)
ZOOKEEPER-1346. Add Jetty HTTP server support for four letter words.
(Skye Wanderman-Milne, Bill Havanki via phunt)
BUGFIXES:
ZOOKEEPER-1900. NullPointerException in truncate (Camille Fournier)
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -290,10 +290,21 @@ document.write("Last Published: " + document.lastModified);
<li>
<a href="#Communication+using+the+Netty+framework">Communication using the Netty framework</a>
</li>
<li>
<a href="#sc_adminserver_config">AdminServer configuration</a>
</li>
</ul>
</li>
<li>
<a href="#sc_zkCommands">ZooKeeper Commands: The Four Letter Words</a>
<a href="#sc_zkCommands">ZooKeeper Commands</a>
<ul class="minitoc">
<li>
<a href="#The+Four+Letter+Words">The Four Letter Words</a>
</li>
<li>
<a href="#sc_adminserver">The AdminServer</a>
</li>
</ul>
</li>
<li>
<a href="#sc_dataFileManagement">Data File Management</a>
......@@ -730,7 +741,7 @@ server.3=zoo3:2888:3888</pre>
<li>
<p>
<a href="#sc_zkCommands">ZooKeeper Commands: The Four Letter Words</a>
<a href="#sc_zkCommands">ZooKeeper Commands</a>
</p>
</li>
......@@ -1648,59 +1659,97 @@ server.3=zoo3:2888:3888</pre>
<p>
TBD - how to manage certificates
</p>
<a name="sc_adminserver_config"></a>
<h4>AdminServer configuration</h4>
<p>
<strong>New in 3.5.0:</strong> The following
options are used to configure the <a href="#sc_adminserver">AdminServer</a>.</p>
<dl>
<dt>
<term>admin.enableServer</term>
</dt>
<dd>
<p>(Java system property: <strong>zookeeper.admin.enableServer</strong>)</p>
<p>Set to "false" to disable the AdminServer. By default the
AdminServer is enabled.</p>
</dd>
<dt>
<term>admin.serverPort</term>
</dt>
<dd>
<p>(Java system property: <strong>zookeeper.admin.serverPort</strong>)</p>
<p>The port the embedded Jetty server listens on. Defaults to 8080.</p>
</dd>
<dt>
<term>admin.commandURL</term>
</dt>
<dd>
<p>(Java system property: <strong>zookeeper.admin.commandURL</strong>)</p>
<p>The URL for listing and issuing commands relative to the
root URL. Defaults to "/commands".</p>
</dd>
</dl>
<a name="sc_zkCommands"></a>
<h3 class="h4">ZooKeeper Commands: The Four Letter Words</h3>
<h3 class="h4">ZooKeeper Commands</h3>
<a name="The+Four+Letter+Words"></a>
<h4>The Four Letter Words</h4>
<p>ZooKeeper responds to a small set of commands. Each command is
composed of four letters. You issue the commands to ZooKeeper via telnet
or nc, at the client port.</p>
composed of four letters. You issue the commands to ZooKeeper via telnet
or nc, at the client port.</p>
<p>Three of the more interesting commands: "stat" gives some
general information about the server and connected clients,
while "srvr" and "cons" give extended details on server and
connections respectively.</p>
general information about the server and connected clients,
while "srvr" and "cons" give extended details on server and
connections respectively.</p>
<dl>
<dt>
<term>conf</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Print
details about serving configuration.</p>
details about serving configuration.</p>
</dd>
<dt>
<term>cons</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> List
full connection/session details for all clients connected
to this server. Includes information on numbers of packets
received/sent, session id, operation latencies, last
operation performed, etc...</p>
full connection/session details for all clients connected
to this server. Includes information on numbers of packets
received/sent, session id, operation latencies, last
operation performed, etc...</p>
</dd>
<dt>
<term>crst</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Reset
connection/session statistics for all connections.</p>
connection/session statistics for all connections.</p>
</dd>
<dt>
<term>dump</term>
</dt>
<dd>
<p>Lists the outstanding sessions and ephemeral nodes. This
only works on the leader.</p>
only works on the leader.</p>
</dd>
<dt>
<term>envi</term>
</dt>
......@@ -1708,21 +1757,21 @@ server.3=zoo3:2888:3888</pre>
<p>Print details about serving environment</p>
</dd>
<dt>
<term>ruok</term>
</dt>
<dd>
<p>Tests if server is running in a non-error state. The server
will respond with imok if it is running. Otherwise it will not
respond at all.</p>
will respond with imok if it is running. Otherwise it will not
respond at all.</p>
<p>A response of "imok" does not necessarily indicate that the
server has joined the quorum, just that the server process is active
and bound to the specified client port. Use "stat" for details on
state wrt quorum and client connection information.</p>
server has joined the quorum, just that the server process is active
and bound to the specified client port. Use "stat" for details on
state wrt quorum and client connection information.</p>
</dd>
<dt>
<term>srst</term>
</dt>
......@@ -1730,105 +1779,136 @@ server.3=zoo3:2888:3888</pre>
<p>Reset server statistics.</p>
</dd>
<dt>
<term>srvr</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Lists
full details for the server.</p>
full details for the server.</p>
</dd>
<dt>
<term>stat</term>
</dt>
<dd>
<p>Lists brief details for the server and connected
clients.</p>
clients.</p>
</dd>
<dt>
<term>wchs</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Lists
brief information on watches for the server.</p>
brief information on watches for the server.</p>
</dd>
<dt>
<term>wchc</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Lists
detailed information on watches for the server, by
session. This outputs a list of sessions(connections)
with associated watches (paths). Note, depending on the
number of watches this operation may be expensive (ie
impact server performance), use it carefully.</p>
detailed information on watches for the server, by
session. This outputs a list of sessions(connections)
with associated watches (paths). Note, depending on the
number of watches this operation may be expensive (ie
impact server performance), use it carefully.</p>
</dd>
<dt>
<term>wchp</term>
</dt>
<dd>
<p>
<strong>New in 3.3.0:</strong> Lists
detailed information on watches for the server, by path.
This outputs a list of paths (znodes) with associated
sessions. Note, depending on the number of watches this
operation may be expensive (ie impact server performance),
use it carefully.</p>
detailed information on watches for the server, by path.
This outputs a list of paths (znodes) with associated
sessions. Note, depending on the number of watches this
operation may be expensive (ie impact server performance),
use it carefully.</p>
</dd>
<dt>
<term>mntr</term>
</dt>
<dd>
<p>
<strong>New in 3.4.0:</strong> Outputs a list
of variables that could be used for monitoring the health of the cluster.</p>
of variables that could be used for monitoring the health of the cluster.</p>
<pre class="code">$ echo mntr | nc localhost 2185
zk_version 3.4.0
zk_avg_latency 0
zk_max_latency 0
zk_min_latency 0
zk_packets_received 70
zk_packets_sent 69
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count 4
zk_watch_count 0
zk_ephemerals_count 0
zk_approximate_data_size 27
zk_followers 4 - only exposed by the Leader
zk_synced_followers 4 - only exposed by the Leader
zk_pending_syncs 0 - only exposed by the Leader
zk_open_file_descriptor_count 23 - only available on Unix platforms
zk_max_file_descriptor_count 1024 - only available on Unix platforms
</pre>
zk_version 3.4.0
zk_avg_latency 0
zk_max_latency 0
zk_min_latency 0
zk_packets_received 70
zk_packets_sent 69
zk_outstanding_requests 0
zk_server_state leader
zk_znode_count 4
zk_watch_count 0
zk_ephemerals_count 0
zk_approximate_data_size 27
zk_followers 4 - only exposed by the Leader
zk_synced_followers 4 - only exposed by the Leader
zk_pending_syncs 0 - only exposed by the Leader
zk_open_file_descriptor_count 23 - only available on Unix platforms
zk_max_file_descriptor_count 1024 - only available on Unix platforms
</pre>
<p>The output is compatible with java properties format and the content
may change over time (new keys added). Your scripts should expect changes.</p>
may change over time (new keys added). Your scripts should expect changes.</p>
<p>ATTENTION: Some of the keys are platform specific and some of the keys are only exported by the Leader. </p>
<p>The output contains multiple lines with the following format:</p>
<pre class="code">key \t value</pre>
</dd>
</dl>
<p>Here's an example of the <strong>ruok</strong>
command:</p>
command:</p>
<pre class="code">$ echo ruok | nc 127.0.0.1 5111
imok
</pre>
imok
</pre>
<a name="sc_adminserver"></a>
<h4>The AdminServer</h4>
<p>
<strong>New in 3.5.0: </strong>The AdminServer is
an embedded Jetty server that provides an HTTP interface to the four
letter word commands. By default, the server is started on port 8080,
and commands are issued by going to the URL "/commands/[command name]",
e.g., http://localhost:8080/commands/stat. The command response is
returned as JSON. Unlike the original protocol, commands are not
restricted to four-letter names, and commands can have multiple names;
for instance, "stmk" can also be referred to as "set_trace_mask". To
view a list of all available commands, point a browser to the URL
/commands (e.g., http://localhost:8080/commands). See the <a href="#sc_adminserver_config">AdminServer configuration options</a>
for how to change the port and URLs.</p>
<p>The AdminServer is enabled by default, but can be disabled by either:</p>
<ul>
<li>
<p>Setting the zookeeper.admin.enableServer system
property to false.</p>
</li>
<li>
<p>Removing Jetty from the classpath. (This option is
useful if you would like to override ZooKeeper's jetty
dependency.)</p>
</li>
</ul>
<p>Note that the TCP four letter word interface is still available if
the AdminServer is disabled.</p>
<a name="sc_dataFileManagement"></a>
<h3 class="h4">Data File Management</h3>
<p>ZooKeeper stores its data in a data directory and its transaction
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -76,5 +76,8 @@
rev="3.2.1" conf="releaseaudit->default"/>
<dependency org="net.java.dev.javacc" name="javacc" rev="5.0" />
<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.26" />
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.9.11" />
</dependencies>
</ivy-module>
......@@ -1320,194 +1320,266 @@ server.3=zoo3:2888:3888</programlisting>
</section>
<section id="sc_adminserver_config">
<title>AdminServer configuration</title>
<para><emphasis role="bold">New in 3.5.0:</emphasis> The following
options are used to configure the <ulink
url="#sc_adminserver">AdminServer</ulink>.</para>
<variablelist>
<varlistentry>
<term>admin.enableServer</term>
<listitem>
<para>(Java system property: <emphasis
role="bold">zookeeper.admin.enableServer</emphasis>)</para>
<para>Set to "false" to disable the AdminServer. By default the
AdminServer is enabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>admin.serverPort</term>
<listitem>
<para>(Java system property: <emphasis
role="bold">zookeeper.admin.serverPort</emphasis>)</para>
<para>The port the embedded Jetty server listens on. Defaults to 8080.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>admin.commandURL</term>
<listitem>
<para>(Java system property: <emphasis
role="bold">zookeeper.admin.commandURL</emphasis>)</para>
<para>The URL for listing and issuing commands relative to the
root URL. Defaults to "/commands".</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
<section id="sc_zkCommands">
<title>ZooKeeper Commands: The Four Letter Words</title>
<title>ZooKeeper Commands</title>
<para>ZooKeeper responds to a small set of commands. Each command is
composed of four letters. You issue the commands to ZooKeeper via telnet
or nc, at the client port.</para>
<section>
<title>The Four Letter Words</title>
<para>ZooKeeper responds to a small set of commands. Each command is
composed of four letters. You issue the commands to ZooKeeper via telnet
or nc, at the client port.</para>
<para>Three of the more interesting commands: "stat" gives some
general information about the server and connected clients,
while "srvr" and "cons" give extended details on server and
connections respectively.</para>
<para>Three of the more interesting commands: "stat" gives some
general information about the server and connected clients,
while "srvr" and "cons" give extended details on server and
connections respectively.</para>
<variablelist>
<varlistentry>
<term>conf</term>
<variablelist>
<varlistentry>
<term>conf</term>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Print
details about serving configuration.</para>
</listitem>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Print
details about serving configuration.</para>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term>cons</term>
<varlistentry>
<term>cons</term>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> List
full connection/session details for all clients connected
to this server. Includes information on numbers of packets
received/sent, session id, operation latencies, last
operation performed, etc...</para>
</listitem>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> List
full connection/session details for all clients connected
to this server. Includes information on numbers of packets
received/sent, session id, operation latencies, last
operation performed, etc...</para>
</listitem>
</varlistentry>
</varlistentry>
<varlistentry>
<term>crst</term>
<varlistentry>
<term>crst</term>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Reset
connection/session statistics for all connections.</para>
</listitem>
</varlistentry>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Reset
connection/session statistics for all connections.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>dump</term>
<varlistentry>
<term>dump</term>
<listitem>
<para>Lists the outstanding sessions and ephemeral nodes. This
only works on the leader.</para>
</listitem>
</varlistentry>
<listitem>
<para>Lists the outstanding sessions and ephemeral nodes. This
only works on the leader.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>envi</term>
<varlistentry>
<term>envi</term>
<listitem>
<para>Print details about serving environment</para>
</listitem>
</varlistentry>
<listitem>
<para>Print details about serving environment</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ruok</term>
<varlistentry>
<term>ruok</term>
<listitem>
<para>Tests if server is running in a non-error state. The server
will respond with imok if it is running. Otherwise it will not
respond at all.</para>
<para>A response of "imok" does not necessarily indicate that the
server has joined the quorum, just that the server process is active
and bound to the specified client port. Use "stat" for details on
state wrt quorum and client connection information.</para>
</listitem>
</varlistentry>
<listitem>
<para>Tests if server is running in a non-error state. The server
will respond with imok if it is running. Otherwise it will not
respond at all.</para>
<para>A response of "imok" does not necessarily indicate that the
server has joined the quorum, just that the server process is active
and bound to the specified client port. Use "stat" for details on
state wrt quorum and client connection information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>srst</term>
<varlistentry>
<term>srst</term>
<listitem>
<para>Reset server statistics.</para>
</listitem>
</varlistentry>
<listitem>
<para>Reset server statistics.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>srvr</term>
<varlistentry>
<term>srvr</term>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
full details for the server.</para>
</listitem>
</varlistentry>
<listitem>
<para><emphasis role="bold">New in 3.3.0:</emphasis> Lists
full details for the server.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>stat</term>
<varlistentry>