felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Felix > 4.2. Remote Console
Date Mon, 12 Oct 2009 16:55:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=FELIX&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/FELIX/4.2.+Remote+Console">4.2.
Remote Console</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~fdiotalevi">filippo
diotalevi</a>
    </h4>
     changed from screenshot to {code}
          <div id="versionComment" class="noteMacro" style="display:none; padding: 5px;">
     changed from screenshot to {code}<br />
     </div>
          <br/>
     <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/FELIX/4.1.+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/FELIX/4.1.+Commands">4.1.
Commands</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/FELIX/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/FELIX/4.+Understanding+Karaf">4. Understanding Karaf</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/FELIX/4.3.+Logging+system">4.3.
Logging system</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/FELIX/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 the Kernel, 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 Felix Karaf client
  -a [address]  specify the URL 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
  [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 the Kernel 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>
<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td>
<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>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/forbidden.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>Error messages
when using some ssh clients</b><br /></td></tr></table></div>
<p>Some SSH clients will prompt some harmless warnings when connecting to ServiceMix
Kernel.<br/>
In particular, openssh 5.1p1 will display the following output:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
channel_by_id: 1: bad id: channel free
channel_input_success_failure: 1: unknown
channel_by_id: 1: bad id: channel free
channel_input_success_failure: 1: unknown
</pre>
</div></div></td></tr></table></div>

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

<h2><a name="4.2.RemoteConsole-UsinganotherKernelinstance"></a>Using another
Kernel 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 Kernel instance
to start the client</b><br /><p>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.</p></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">
remote rsh tcp:<span class="code-comment">//localhost:8101/ -u karaf -p karaf </span>
</pre>
</div></div>

<p>You can also do that in a single command line from the prompt by appending the previous
ServiceMix command to the shell command:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
bin/karaf client remote rsh 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 Kernel, 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.felix.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">
startLocalConsole=${karaf.startLocalConsole}
startRemoteShell=${karaf.startRemoteShell}
sshPort=8101
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/FELIX/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/FELIX/4.1.+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/FELIX/4.1.+Commands">4.1.
Commands</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/FELIX/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/FELIX/4.+Understanding+Karaf">4. Understanding Karaf</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;<a href="/confluence/display/FELIX/4.3.+Logging+system">4.3.
Logging system</a></td><td class='ScrollbarNextIcon'><a href="/confluence/display/FELIX/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="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/FELIX/4.2.+Remote+Console">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=78794&revisedVersion=17&originalVersion=16">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/FELIX/4.2.+Remote+Console?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message