karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Karaf > 4.2. Remote Console
Date Fri, 16 Jul 2010 11:59:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/3/_/styles/combined.css?spaceKey=KARAF&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/KARAF/4.2.+Remote+Console">4.2.
Remote Console</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~gnodet">Guillaume
Nodet</a>
    </h4>
        <br/>
                         <h4>Changes (6)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >There are a few parameters that
can be set on the command line to change the URL used to connect to <span class="diff-added-words"style="background-color:
#dfd;">Karaf,</span> the <span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">Kernel,
the</span> user or the password. <br></td></tr>
            <tr><td class="diff-unchanged" >All these parameters are detailed
in the help screen: <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Once the console appears, you can
run the {{remote rsh}} command to connect to the other Kernel: <br>{code} <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">remote
rsh</span> <span class="diff-added-words"style="background-color: #dfd;">ssh:ssh</span>
tcp://localhost:8101/ -u karaf -p karaf <br></td></tr>
            <tr><td class="diff-unchanged" >{code} <br> <br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">You
can also do that in a single command line from the prompt by appending the previous ServiceMix
command to the shell command: <br>{code} <br>bin/karaf client remote rsh tcp://localhost:8101/
-u karaf -p karaf  <br>{code} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >To verify that your are connected
to the remote instance, run the following command: <br>{code} <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >The defaut configuration is as below:
<br>{code} <br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">startLocalConsole=${karaf.startLocalConsole}</span>
<span class="diff-added-words"style="background-color: #dfd;">sshPort=8102</span>
<br></td></tr>
            <tr><td class="diff-changed-lines" ><span class="diff-deleted-words"style="color:#999;background-color:#fdd;text-decoration:line-through;">startRemoteShell=${karaf.startRemoteShell}</span>
<span class="diff-added-words"style="background-color: #dfd;">sshHost=0.0.0.0</span>
<br></td></tr>
            <tr><td class="diff-deleted-lines" style="color:#999;background-color:#fdd;text-decoration:line-through;">sshPort=8101
<br></td></tr>
            <tr><td class="diff-unchanged" >sshRealm=karaf <br>hostKey=${karaf.base}/etc/host.key
<br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/KARAF/4.1.+Console+and+Commands"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/KARAF/4.1.+Console+and+Commands">4.1.
Console and Commands</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/KARAF/4.+Understanding+Karaf"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/KARAF/4.+Understanding+Karaf">4. Understanding Karaf</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/KARAF/4.3.+Logging+system">4.3.
Logging system</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/KARAF/4.3.+Logging+system"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>
<p><a name="4.2.RemoteConsole-top"></a></p>

<h1><a name="4.2.RemoteConsole-4.2.RemoteConsole"></a>4.2. Remote Console</h1>

<p>The remote console feature allows to connect to a running Karaf instance from a remote
computer and perform all the operations that are usually accessible from the local console.</p>

<h2><a name="4.2.RemoteConsole-Launchoptions"></a>Launch options</h2>

<p>The Karaf shell scripts supports a number of options to control the remote console:</p>
<ul>
	<li><b><tt>console</tt></b>: launch Karaf in the default mode
(both local and remote console activated).  This is the default mode</li>
	<li><b><tt>server</tt></b>: launch Karaf in with a remote console
but no local console</li>
	<li><b><tt>client</tt></b>: launch Karaf in with a local console
only</li>
</ul>


<p>These options affect two system properties that can be set if you don't use the standard
shell scripts:</p>
<ul>
	<li><tt>karaf.startLocalConsole</tt></li>
	<li><tt>karaf.startRemoteShell</tt></li>
</ul>


<h2><a name="4.2.RemoteConsole-Usingtheclientjar"></a>Using the client jar</h2>

<p>It is also possible to use a more lightweight way to connect to a Karaf instance
using the following command line:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
java -jar lib/karaf-client.jar
</pre>
</div></div>

<p>There are a few parameters that can be set on the command line to change the URL
used to connect to Karaf, the user or the password.<br/>
All these parameters are detailed in the help screen:</p>

<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-java">
&gt; java -jar lib/karaf-client.jar --help
Apache Karaf client
  -a [port]     specify the port to connect to
  -h [host]     specify the host to connect to
  -u [user]     specify the user name
  -p [password] specify the password
  --help        shows <span class="code-keyword">this</span> help message
  -v            raise verbosity
  -r [attempts] retry connection establishment (up to attempts times)
  -d [delay]    intra-retry delay (defaults to 2 seconds)
  [commands]    commands to run
If no commands are specified, the client will be put in an interactive mode
</pre>
</div></div>

<p>For example, to shut down Karaf from the command line, you can run the following
command:</p>

<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeContent
panelContent">
<pre class="code-java">
&gt; java -jar lib/karaf-client.jar 
smx@root:/&gt; osgi:shutdown
smx@root:/&gt;
&gt;
</pre>
</div></div>

<p>The client jar also supports passing command line arguments to the remote Karaf.</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&gt; java -jar lib/karaf-client.jar osgi:shutdown
&gt;
</pre>
</div></div>

<p><a href="#4.2.RemoteConsole-top">top</a></p>

<h2><a name="4.2.RemoteConsole-UsinganSSHclient"></a>Using an SSH client</h2>

<p>You can use any standard SSH client to connect to a Karaf instance.  The default
port is 8101.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
&gt; ssh -p 8101 -l karaf localhost
karaf@localhost's password: karaf
karaf@root:/&gt;
</pre>
</div></div>

<p><a href="#4.2.RemoteConsole-top">top</a></p>

<h2><a name="4.2.RemoteConsole-UsinganotherKarafinstance"></a>Using another
Karaf instance</h2>

<p>First, open a terminal and launch Karaf in server mode (you could use a Karaf instance
in console mode too):</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
bin/karaf server
</pre>
</div></div>

<p>On another terminal, start another Karaf instance in client mode:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
bin/karaf client
</pre>
</div></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/check.gif" width="16" height="16"
align="absmiddle" alt="" border="0"></td><td><b>User another Karaf instance
to start the client</b><br />At this point in time, you can not use the same Karaf
installation to start both the server and the client, so you need to create a new instance
using the 'admin create xxx' command and use that one to start the client.  If you are on
a different host or already use another copy of Karaf, this requirement does not hold.</td></tr></table></div>

<p>Once the console appears, you can run the <tt>remote rsh</tt> command
to connect to the other Kernel:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
ssh:ssh tcp:<span class="code-comment">//localhost:8101/ -u karaf -p karaf </span>
</pre>
</div></div>

<p>To verify that your are connected to the remote instance, run the following command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
info
</pre>
</div></div>
<p>and check the system informations.</p>

<h3><a name="4.2.RemoteConsole-Configuration"></a>Configuration</h3>

<p>The TCP port is configured at the following location:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
[KARAF]/etc/org.apache.karaf.shell.cfg
</pre>
</div></div>

<p>The defaut configuration is as below:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
sshPort=8102
sshHost=0.0.0.0
sshRealm=karaf
hostKey=${karaf.base}/etc/host.key
</pre>
</div></div>

<p>The port used can easily be changed by changing the default port <tt>8101</tt>
in the <tt>sshPort</tt> property.</p>

<p>The security realm used by the console when authenticating remote users is named
<tt>karaf</tt>, so you can override this realm as explained in the <a href="/confluence/display/KARAF/4.5.+Security+framework"
title="4.5. Security framework">security section</a>.  </p>

<p><a href="#4.2.RemoteConsole-top">top</a></p>
<style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
#f0f0f0}
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/KARAF/4.1.+Console+and+Commands"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/KARAF/4.1.+Console+and+Commands">4.1.
Console and Commands</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/KARAF/4.+Understanding+Karaf"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/KARAF/4.+Understanding+Karaf">4. Understanding Karaf</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/KARAF/4.3.+Logging+system">4.3.
Logging system</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/KARAF/4.3.+Logging+system"><img
border='0' align='middle' src='/confluence/images/icons/forwd_16.gif' width='16' height='16'></a></td></tr></table></div>

    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/KARAF/4.2.+Remote+Console">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=78794&revisedVersion=20&originalVersion=19">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/KARAF/4.2.+Remote+Console?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message