blob: fbf4eb634e82cf253145606cda641a3e7f2416bf [file] [log] [blame]
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE- 2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>Apache BookKeeper - Hedwig Console</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="/archives/css/bootstrap.min.css" rel="stylesheet">
<link href="/archives/css/bootstrap-responsive.min.css" rel="stylesheet">
<link href="/archives/css/styles.css" rel="stylesheet">
</head>
<body>
<header class="navbar navbar-inverse navbar-static-top" role="banner">
<div class="container">
<div class="navbar-header hidden-xs hidden-sm">
<a class="navbar-brand navbar-logo" href="/archives/"><img class="img-responsive" src="/archives/img/bookkeeper_blk40.png" alt="Bookkeeper Logo" /></a>
</div>
<div class="navbar-header">
<button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/archives/">Apache BookKeeper</a>
</div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<ul class="nav navbar-nav">
<li><a href="/archives/releases.html">Download</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Documentation<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/archives/docs/master">Latest (master)</a></li>
<li><ul>
<li><a href="/archives/docs/master/apidocs">Java API docs</a></li>
<li><a href="/archives/docs/master/bookkeeperTutorial.html">Tutorial</a></li>
<li><a href="/archives/docs/master/bookkeeperConfig.html">Admin guide</a></li>
</ul><li>
<li><a href="/archives/docs/r4.4.0">Release 4.4.0</a></li>
<li class="divider"></li>
<li>Older releases</li>
<li><a href="/archives/docs/r4.3.2">Release 4.3.2</a></li>
<li><a href="/archives/docs/r4.3.1">Release 4.3.1</a></li>
<li><a href="/archives/docs/r4.3.0">Release 4.3.0</a></li>
<li><a href="/archives/docs/r4.2.4">Release 4.2.4</a></li>
<li><a href="/archives/docs/r4.2.3">Release 4.2.3</a></li>
<li><a href="/archives/docs/r4.2.2">Release 4.2.2</a></li>
<li><a href="/archives/docs/r4.2.1">Release 4.2.1</a></li>
<li><a href="/archives/docs/r4.2.0">Release 4.2.0</a></li>
<li><a href="/archives/docs/r4.1.0">Release 4.1.0</a></li>
<li><a href="/archives/docs/r4.0.0">Release 4.0.0</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Get Involved<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/archives/lists.html">Mailing Lists</a></li>
<li><a href="/archives/irc.html">IRC</a></li>
<li><a href="/archives/svn.html">Version Control</a></li>
<li><a href="https://issues.apache.org/jira/browse/BOOKKEEPER">Issue Tracker</a></li>
</ul>
</li>
<li><a href="https://cwiki.apache.org/confluence/display/BOOKKEEPER/Index">Wiki</a></li>
<!--<li><a href="#">Hedwig</a></li>//-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Project Info<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="/archives/credits.html">Who are we?</a></li>
<li><a href="/archives/bylaws.html">Bylaws</a></li>
<li><a href="http://www.apache.org/licenses/">License</a></li>
<li class="divider"></li>
<li><a href="/archives/privacy.html">Privacy Policy</a></li>
<li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsership</a></li>
<li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
</ul>
</li>
</ul>
<script>
(function() {
var cx = '017580107654524087317:iqnsyimpydg';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div class="navbar-form navbar-right visible-lg" id="googlebox">
<gcse:searchbox-only></gcse:searchbox-only>
</div>
</nav>
</div>
</header>
<div class="container">
<h1>Hedwig Console</h1>
<p>Apache Hedwig provides a console client, which allows users and administrators to interact with a hedwig cluster. </p>
<h2>Connecting to hedwig cluster</h2>
<p>Hedwig console client is shipped with hedwig server package.</p>
<p>To start the console client:</p>
<p> <code>hedwig-server/bin/hedwig console</code></p>
<p>By default, the console client connects to hub server on localhost. If you want the console client to connect to a different hub server, you can override following environment variables.</p>
<table><tr><td><code>HEDWIG_CONSOLE_SERVER_CONF</code></td><td>Path of a hub server configuration file. Override to make hedwig console client connect to correct zookeeper cluster.</td></tr><tr><td><code>HEDWIG_CONSOLE_CLIENT_CONF</code></td><td>Path of a hedwig client configuration file. Override to make hedwig console client communicate with correct hub servers.</td></tr></table>
<p>Once connected, you should see something like:</p>
<pre>
Connecting to zookeeper/bookkeeper using HedwigAdmin
Connecting to default hub server localhost/127.0.0.1:4080
Welcome to Hedwig!
JLine support is enabled
JLine history support is enabled
[hedwig: (standalone) 16]
</pre>
<p>From the shell, type <i>help</i> to get a list of commands that can be executed from the client:</p>
<pre>
[hedwig: (standalone) 16] help
HedwigConsole [options] [command] [args]
Available commands:
pub
sub
closesub
unsub
rmsub
consume
consumeto
pubsub
show
describe
readtopic
set
history
redo
help
quit
exit
Finished 0.0020 s.
</pre>
<p>If you want to know detail usage for each command, type <i>help {command}</i> in the shell. For example:</p>
<pre>
[hedwig: (standalone) 17] help pub
pub: Publish a message to a topic in Hedwig
usage: pub {topic} {message}
{topic} : topic name.
any printable string without spaces.
{message} : message body.
remaining arguments are used as message body to publish.
Finished 0.0 s.
</pre>
<h2>Commands</h2>
<p>All the available commands provided in hedwig console could be categorized into three groups. They are <i>interactive commands</i>, <i>admin commands</i>, <i>utility commands</i>.</p>
<h3>Interactive Commands</h3>
<p>Interactive commands are used by users to communicate with a hedwig cluster. They are <i>pub</i>, <i>sub</i>, <i>closesub</i>, <i>unsub</i>, <i>consume</i> and <i>consumeto</i>.</p>
<p>These commands are quite simple and have same semantics as the <span class="caps">API </span>provided in hedwig client.</p>
<h3> Admin Commands</h3>
<p>Admin commands are used by administrators to operate or debug a hedwig cluster. They are <i>show</i>, <i>describe</i>, <i>pubsub</i> and <i>readtopic</i>.</p>
<p><i>show</i> is used to list all available hub servers or topics in the cluster.</p>
<p>You could use <i>show</i> to list hub servers to know how many hub servers are alive in the cluster.</p>
<pre>
[hedwig: (standalone) 27] show hubs
Available Hub Servers:
192.168.1.102:4080:9876 : 0
Finished 0.0040 s.
</pre>
<p>Also, you could use <i>show</i> to list all topics. If you have a lot of topics on the clusters, this command will take a long time to run.</p>
<pre>
[hedwig: (standalone) 28] show topics
Topic List:
[mytopic]
Finished 0.0020 s.
</pre>
<p>To see the details of a topic, run <i>describe</i>. This shows the metadata of a topic, including topic owner, persistence info, subscriptions info.</p>
<pre>
[hedwig: (standalone) 43] describe topic mytopic
===== Topic Information : mytopic =====
Owner : 192.168.1.102:4080:9876
&gt;&gt;&gt; Persistence Info &lt;&lt;&lt;
Ledger 3 [ 1 ~ 9 ]
&gt;&gt;&gt; Subscription Info &lt;&lt;&lt;
Subscriber mysub : consumeSeqId: local:0
Finished 0.011 s.
</pre>
<p>When you are run the <i>describe</i> command, you should keep in mind that <i>describe</i> command reads the metadata from <i>ZooKeeper</i> directly, so the subscription info might not be completely up to date due to the fact that hub servers update the subscription metadata lazily.</p>
<p>The <i>readtopic</i> command is useful to see which messages have not been consumed by the client.</p>
<pre>
[hedwig: (standalone) 46] readtopic mytopic
&gt;&gt;&gt;&gt;&gt; Ledger 3 [ 1 ~ 9] &lt;&lt;&lt;&lt;&lt;
---------- MSGID=LOCAL(1) ----------
MsgId: LOCAL(1)
SrcRegion: standalone
Message:
hello
---------- MSGID=LOCAL(2) ----------
MsgId: LOCAL(2)
SrcRegion: standalone
Message:
hello 2
---------- MSGID=LOCAL(3) ----------
MsgId: LOCAL(3)
SrcRegion: standalone
Message:
hello 3
...
</pre>
<p><i>pubsub</i> is another useful command for administrators. It can be used to test availability and functionality of a cluster. It generates a temporary subscriber id with the current timestamp, subscribes to the given topic using generated subscriber id, publishes a message to given topic and testes whether the subscriber received the message.</p>
<pre>
[hedwig: (standalone) 48] pubsub testtopic testsub- 10 test message for availability
Starting PUBSUB test ...
Sub topic testtopic, subscriber id testsub--1338126964504
Pub topic testtopic : test message for availability-1338126964504
Received message : test message for availability-1338126964504
PUBSUB SUCCESS. TIME: 377 MS
Finished 0.388 s.
</pre>
<h3>Utility Commands</h3>
<p>Utility Commands are <i>help</i>, <i>history</i>, <i>redo</i>, <i>quit</i> and <i>exit</i>.</p>
<p><i>quit</i> and <i>exit</i> are used to exit console, while <i>history</i> and <i>redo</i> are used to manage the history of commands executed in the shell.</p>
</div>
<footer class="footer">
<div class="container">
<p class="text-muted">Copyright &copy; 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.<br/>
Apache BookKeeper, BookKeeper, Apache, Apache ZooKeeper, ZooKeeper, the Apache feather logo, and the Apache BookKeeper project logo are trademarks of The Apache Software Foundation.</p>
</div>
</footer>
<script src="//code.jquery.com/jquery.js"></script>
<script src="/archives/js/bootstrap.min.js"></script>
</body>
</html>