4.2. Remote Console
The remote console feature allows to connect to a running ServiceMix instance from a remote computer and perform all the operations that are usually accessible from the local console.
Launch options
The ServiceMix Kernel shell scripts supports a number of options to control the remote console:
console
: launch ServiceMix Kernel in the default mode (both local and remote console activated). This is the default modeserver
: launch ServiceMix Kernel in with a remote console but no local consoleclient
: launch ServiceMix Kernel in with a local console only
These options affect two system properties that can be set if you don't use the standard shell scripts:
servicemix.startLocalConsole
servicemix.startRemoteShell
Using the client jar
From Apache ServiceMix Kernel 1.1.0 and posterior versions, it is possible to use a more lightweight way to connect to a ServiceMix Kernel instance using the following command line:
java -jar lib/servicemix-client.jar
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.
All these parameters are detailed in the help screen:
> java -jar lib/servicemix-client.jar --help
Apache ServiceMix Kernel 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 this help message
[commands] commands to run
If no commands are specified, the client will be put in an interactive mode
For example, to shut down the Kernel from the command line, you can run the following command:
> java -jar lib/servicemix-client.jar
smx@root:/> osgi/shutdown
smx@root:/>
>
Sending direct commands from the client
The client jar does not yet support passing command line arguments to the remote ServiceMix Kernel.
In order to do so, you can create a text file containing the commands and use the system console to redirect this file to the input stream:
> echo osgi/shutdown > command.txt > java -jar lib/servicemix-client.jar < command.txt >
Using an SSH client
You can use any standard SSH client to connect to a ServiceMix Kernel instance. The default port is 8101.
> ssh -p 8101 -l smx localhost smx@localhost's password: smx smx@root:/>
Error messages when using some ssh clients
Some SSH clients will prompt some harmless warnings when connecting to ServiceMix Kernel.
In particular, openssh 5.1p1 will display the following output:
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
Using another Kernel instance
First, open a terminal and launch a Kernel in server mode (you could use a Kernel in console mode too):
bin/servicemix server
On another terminal, start a Kernel in client mode:
bin/servicemix client
User another Kernel instance to start the client
At this point in time, you can not use the same Kernel 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 ServiceMix Kernel, this requirement does not hold.
Once the console appears, you can run the remote rsh
command to connect to the other Kernel:
remote rsh tcp://localhost:8101/ -u smx -p smx
You can also do that in a single command line from the prompt by appending the previous ServiceMix command to the shell command:
bin/servicemix client remote rsh tcp://localhost:8101/ -u smx -p smx
To verify that your are connected to the remote Kernel, run the following command:
info
and check the system informations.
Configuration
The TCP port is configured at the following location:
[KERNEL]/etc/org.apache.servicemix.shell.cfg
The defaut configuration is as below:
startLocalConsole=${servicemix.startLocalConsole} startRemoteShell=${servicemix.startRemoteShell} remoteShellLocation=tcp://0.0.0.0:8101/
The port used can easily be changed by changing the default port 8101
in the remoteShellLocation
property.
To switch to a secured channel using SSL encryption, edit the above file and change the remoteShellLocation
property to use SSL as below:
remoteShellLocation=tcp://0.0.0.0:8101/
The realm used by the console when authenticating remote users is named RshServer
, so you should override this realm as explained in the 4.5. Security framework. If you want to use your own keystore and truststore when enabling SSL, you can add the following properties to the configuration file:
clientKeyAlias=servicemix clientKeystore=RshKeystore clientTruststore=RshTruststore serverKeyAlias=servicemix serverKeystore=RshKeystore serverTruststore=RshTruststore
You can either deploy another set of keystores that use the above names or change the named used and deploy new keystores. The key aliases must be set to a valid key in the store that will be used to secure the communication.