Connecting and disconnecting remotely
Using the ssh:ssh command
You can connect to a remote Karaf's console using the ssh:ssh command.
karaf@trun> ssh:ssh -l tadmin -P tadmin -p 8101 hostname
To confirm that you have connected to the correct Karaf instance, type shell:info at the karaf> prompt. Information about the currently connected instance is returned, as shown.
Karaf Karaf home /local/apache-karaf-2.0.0 Karaf base /local/apache-karaf-2.0.0 OSGi Framework org.eclipse.osgi - 3.5.1.R35x_v20090827 JVM Java Virtual Machine Java HotSpot(TM) Server VM version 14.1-b02 ...
Using the Karaf client
The Karaf client allows you to securely connect to a remote Karaf instance without having to launch a Karaf instance locally.
For example, to quickly connect to a Karaf instance running in server mode on the same machine, run the following command from the karaf-install-dir directory: bin/client. More usually, you would provide a hostname, port, username and password to connect to a remote instance. And, if you were using the client within a larger script, you could append console commands as follows:
bin/client -a 8101 -h hostname -u tadmin -p tadmin feature:install wrapper
To display the available options for the client, type:
> bin/client --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 this 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
Using a plain SSH client
You can also connect using a plain SSH client from your *nix system or Windows SSH client like Putty.
~$ ssh -p 8101 tadmin@localhost
tadmin@localhost's password:
Disconnecting from a remote console
To disconnect from a remote console, press shell:logout or simply logout at the Karaf prompt.
,