在我们真正学习ServiceMix前先学习一下ServiceMix的基本命令.
运行bin目录下的servicemix.bat,如果有防火墙,请按提示打开相应端口。
Please wait while Apache ServiceMix is starting...
100% [=======================================================================>]
____ _ __ __ _
/ ___| ___ _ ____ _(_) ___ ___| \/ (_)_ __
\___ \ / _ \ '__\ \ / / |/ __/ _ \ |\/| | \ \/ /
___) | __/ | \ V /| | (_| __/ | | | |> <
|____/ \___|_| \_/ |_|\___\___|_| |_|_/_/\_\
Apache ServiceMix (5.0.0)
Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or 'osgi:shutdown' to shutdown ServiceMix.
karaf@root>
这样我们就进入到ServiceMix环境下了,按tab键会显示命令列表,
karaf@root> Display all 284 possibilities? (y or n)
*:help activemq:browse
activemq:bstat activemq:dstat
activemq:list activemq:purge
activemq:query addurl
admin:change-opts admin:change-rmi-registry-port
admin:change-rmi-server-port admin:change-ssh-port
admin:clone admin:connect
admin:create admin:destroy
admin:list admin:rename
admin:start admin:status
admin:stop alias
backlog-tracer-dump backlog-tracer-info
backlog-tracer-start backlog-tracer-stop
browse bstat
bundle-level bundle-services
camel:backlog-tracer-dump camel:backlog-tracer-info
camel:backlog-tracer-start camel:backlog-tracer-stop
camel:context-info camel:context-list
camel:context-start camel:context-stop
camel:endpoint-list camel:route-info
camel:route-list camel:route-profile
camel:route-reset-stats camel:route-resume
camel:route-show camel:route-start
camel:route-stop camel:route-suspend
cancel cat
change-opts change-rmi-registry-port
change-rmi-server-port change-ssh-port
chooseurl cl
classes clear
clone config:cancel
config:delete config:edit
config:list config:propappend
config:propdel config:proplist
config:propset config:update
connect context-info
context-list context-start
context-stop create
create-dump cxf:list-busses
cxf:list-endpoints cxf:start-endpoint
cxf:stop-endpoint date
delete destroy
dev:create-dump dev:dynamic-import
dev:framework dev:print-stack-traces
dev:restart dev:show-tree
dev:system-property dev:wait-for-service
dev:watch display
display-exception dstat
dynamic-import each
echo edit
enable-3x-aliases endpoint-list
exec exports
features:addurl features:chooseurl
features:info features:install
features:list features:listrepositories
features:listurl features:listversions
features:refreshurl features:removerepository
features:removeurl features:uninstall
fi find-class
framework fu
get grep
head headers
help history
if imports
info install
jaas:cancel jaas:manage
jaas:pending jaas:realms
jaas:roleadd jaas:roledel
jaas:update jaas:useradd
jaas:userdel jaas:users
java la
ld lde
list list-busses
list-endpoints listrepositories
listurl listversions
log:clear log:display
log:display-exception log:get
log:list log:set
log:tail logout
ls man
manage more
name new
osgi:bundle-level osgi:bundle-services
osgi:classes osgi:find-class
osgi:headers osgi:info
osgi:install osgi:list
osgi:ls osgi:name
osgi:refresh osgi:resolve
osgi:restart osgi:shutdown
osgi:start osgi:start-level
osgi:stop osgi:uninstall
osgi:update osgi:version
packages:exports packages:imports
pending print-stack-traces
printf propappend
propdel proplist
propset purge
query realms
refresh refreshurl
removerepository removeurl
rename resolve
restart roleadd
roledel route-info
route-list route-profile
route-reset-stats route-resume
route-show route-start
route-stop route-suspend
set shell:alias
shell:cat shell:clear
shell:date shell:each
shell:echo shell:exec
shell:grep shell:head
shell:history shell:if
shell:info shell:java
shell:logout shell:more
shell:new shell:printf
shell:sleep shell:sort
shell:source shell:tac
shell:tail shell:watch
shell:wc show-tree
shutdown sleep
sort source
ssh ssh:ssh
ssh:sshd sshd
start start-endpoint
start-level status
stop stop-endpoint
system-property tac
tail uninstall
update useradd
userdel users
version wait-for-service
watch wc
web:list
karaf@root>
activemq:* 这是与activemq相关的命令
camel:* 这是与camel相关的命令
features:* 这是与系统安装卸载包相关的命令,可以用来添加新的包。
log:* 这是与日志相关的命令。
osgi:* 系统命令,可以查询已经运行服务,关闭系统,关闭服务等。等同无osgi:开头系统命令,如osgi:list等同于list,osgi:start等同于start,osgi:stop等同于stop命令。
这些基本的命令简单的介绍就到这里,其它开头的命令等我们用到的时候再介绍。
这一次我们做两个简单的练习,一个是安装webconsole,一个是启动和停止一个camel的router服务。
组件(feature)管理的命令是features:*,我们要查询有没有一个组件时可以执行命令:
features:list | grep XXX
如查询webconsole,
karaf@root> feature:list | grep webconsole
pipe: org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found:
feature:list
karaf@root> features:list | grep webconsole
[installed ] [2.3.4 ] webconsole-base karaf-2
.3.4 Base support of the Karaf WebConsole
[installed ] [2.3.4 ] webconsole karaf-2
.3.4 Karaf WebConsole for administration and monitoring
[uninstalled] [2.3.4 ] webconsole-scr karaf-2
.3.4 Declarative Service WebConsole plugin support
karaf@root>
找到的分别是 2.3.4版的webconsole,以及webconsole-base,webconsole-src,由名字就可以知道是别对应的是程序,支持库,源码。
karaf@root> features:install webconsole
karaf@root>
执行features:install webconsole就会安装webconsole组件,没有任何提示,执行完成后会继续显示命令窗口。
最后打开 http://localhost:8181/system/console, 要输入用户名密码,默认的是smx,smx,是不是太简单了,要修改去etc下面的users.properties里找吧。
到这里,安装webconsole的过程就完成了,至于这个管理界面,都有英文说明,学习着操作吧。