jboss7 配置指南.docx
《jboss7 配置指南.docx》由会员分享,可在线阅读,更多相关《jboss7 配置指南.docx(62页珍藏版)》请在冰豆网上搜索。
jboss7配置指南
Jboss7配置指南
1.目标听众
这篇文档是为需要安装配置JBossApplicationServer(AS7)的人员编写
1.1开始之前
你需要知道如何下载,安装和运行JBossApplicationServer7.如果你还不了解这些信息,请参考“入门指导"
1.2手册中的示例
手册种大部分的例子会使用部分XML配置文件或者是de-typed的管理模型进行表示
2.客户端
JBossAS7提供三种不同的方式对服务器进行配置和管理:
web,命令行和xml配置文件形式。
无论你选择什么样的配置方式,配置信息都会被同步到各个方式的管理界面上,并且被存储到xml配置文件中。
2.1web接口
web管理客户端是一个GWT的应用,它通过HTPP管理接口来管理域(domain)或者是单独运行(standalone)的服务器
2.1.1HTTP管理接入点
基于HTTP协议的管理接入点负责接入使用http协议与管理层进行交互客户端。
它负责接收使用JSON编解码的协议和de-typedRPC形式的的api来对可管理的域服务器或者单独运行服务器进行管理操作。
web控制台就是通过它来实现的,但基于HTTP协议的管理接入点也可以与其他的管理终端进行集成,交互。
基于HTTP协议的管理点会运行在域控制器(domaincontroller)或者是单独运行服务器上,默认运行在9990端口上。
Xml代码
1.
2. [...]
3.
4.
[xml]viewplaincopyprint?
1.
2. [...]
3.
4.
[...]
(参见standalone/configuration/standalone.xml或者domain/configuration/host.xml)
基于HTTP协议的管理接入点运行在两个不同的context下。
一个用于运行管理的操作另外一个提供对web管理接口的访问。
∙ 域API:
http:
//:
9990/management
∙ Web控制台:
http:
//:
9990/console
2.1.2访问管理控制台:
管理控制台和基于HTTP协议管理的API在统端口上运行,可以通过以下URL进行访问:
∙ http:
//:
9990/console
默认访问web管理页面的URL:
http:
//localhost:
9990/console.
2.1.3 对管理控制台进行加密
web管理控制台通过HTTP管理接口来对服务器进行通信。
对于如何机密HTTP管理接口以及如何启用默认的安全域,请参考一下本文中关于“加密管理接口"章节。
2.2命令行接口
命令行方式的管理工具(CLI)提供了对域和单独运行服务器的管理。
用户可以使用命令行来连接域服务器或者单独运行服务器,通过传输de-typede的管理模型来执行管理操作。
2.2.1 Native管理接入点
Native的管理接入点负责接入使用AS内部协议与管理层进行交互的客户端.它使用基于java对象来描述的管理操作、二进制协议和RPC形式的API来对域和单独运行服务器进行管理操作。
命令行方式的管理工具使用它来实现对服务器的管理,单Native管理接入点也提供了极强的集成能力,可以和其他的客户端进行集成。
Nativeg管理接入点运行在host控制器上或者是一个单独运行服务器上。
如果使用命令行管理工具,Native管理接入点必须被启用.默认Native管理接入点运行在9999端口上:
[...]
参见standalone/configuration/standalone.xml或者domain/configuration/host.xml)
2.2.2运行命令行管理工具
根据操作系统,使用JBossAS7bin目录下的jboss-admin.sh或者jboss-admin.bat来启动命令行管理工具.关于AS7目录的详细信息,请参考"入门指南".
命令行工具启动以后的第一件事情就是连接被管理的JbossAS7实例。
我们通过命令connect进行:
Java代码
1../bin/jboss-admin.sh
2.You are disconnected at the moment. Type 'connect' to connect to the server
3.or 'help' for the list of supported commands.
4.[disconnected /]
5.
6.[disconnected /] connect
7.Connected to domain controller at localhost:
9999
8.
9.[domain@localhost:
9999 /] quit
10.Closed connection to localhost:
9999
[java]viewplaincopyprint?
1../bin/jboss-admin.sh
2.You are disconnected at the moment. Type 'connect' to connect to the server
3.or 'help' for the list of supported commands.
4.[disconnected /]
5.
6.[disconnected /] connect
7.Connected to domain controller at localhost:
9999
8.
9.[domain@localhost:
9999 /] quit
10.Closed connection to localhost:
9999
./bin/jboss-admin.sh
Youaredisconnectedatthemoment.Type'connect'toconnecttotheserver
or'help'forthelistofsupportedcommands.
[disconnected/]
[disconnected/]connect
Connectedtodomaincontrolleratlocalhost:
9999
[domain@localhost:
9999/]quit
Closedconnectiontolocalhost:
9999
localhost:
9999是JBossAS7域控制器客户端连接的默认主机和端口名.主机名和端口都是可选的参数,可以被单独或者一起指定。
想要退出对话,可以键入quit命令来结束。
Xml代码
1.jboss-admin脚本可以接收--cnnect参数:
./jboss-admin.sh --connenct
[xml]viewplaincopyprint?
1.jboss-admin脚本可以接收--cnnect参数:
./jboss-admin.sh --connenct
jboss-admin脚本可以接收--cnnect参数:
./jboss-admin.sh--connenct
help命令用来显示参考帮助文档:
Shell代码
1.[domain@localhost:
9999 /] help
2.Supported commands:
3.
4.cn (or cd) - change the current node path to the argument;
5.connect - connect to the specified host and port;
6.deploy - deploy an application;
7.help (or h) - print this message;
8.history - print or disable/enable/clear the history expansion.
9.ls - list the contents of the node path;
10.pwn (or pwd) - prints the current working node;
11.quit (or q) - quit the command line interface;
12.undeploy - undeploy an application;
13.version - prints the version and environment information.
14.
15.add-jms-queue - creates a new JMS queue
16.remove-jms-queue - removes an existing JMS queue
17.add-jms-topic - creates a new JMS topic
18.remove-jms-topic - removes an existing JMS topic
19.add-jms-cf - creates a new JMS connection factory
20.remove-jms-cf - removes an existing JMS connection factory
21.
22.data-source - allows to add new, modify and remove existing data sources
23.xa-data-source - allows to add new, modify and remove existing XA data sources
[domain@localhost:
9999/]help
Supportedcommands:
cn(orcd)-changethecurrentnodepathtotheargument;
connect-connecttothespecifiedhostandport;
deploy-deployanapplication;
help(orh)-printthismessage;
history-printordisable/enable/clearthehistoryexpansion.
ls-listthecontentsofthenodepath;
pwn(orpwd)-printsthecurrentworkingnode;
quit(orq)-quitthecommandlineinterface;
undeploy-undeployanapplication;
version-printstheversionandenvironmentinformation.
add-jms-queue-createsanewJMSqueue
remove-jms-queue-removesanexistingJMSqueue
add-jms-topic-createsanewJMStopic
remove-jms-topic-removesanexistingJMStopic
add-jms-cf-createsanewJMSconnectionfactory
remove-jms-cf-removesanexistingJMSconnectionfactory
data-source-allowstoaddnew,modifyandremoveexistingdatasources
xa-data-source-allowstoaddnew,modifyandremoveexistingXAdatasources
查看特定命令的详细帮助文档,需要在命令后加"--help"参数来获得。
2.2.3管理请求
管理请求允许与管理模型进行低级别的交互。
它不同于高级别的命令(比如创建一个jms的queue命令:
create-jms-queue),使用管理请求可以对服务器的配置像对直接对xml配置文件进行编辑而进行读和修改操作。
整个配置用一个有地址的资源树进行表示,这个树上的每个节点提供一系列的操作供执行。
一个管理请求包含三个部分:
地址,操作名和可选的操作参数
这是一个管理请求的规约:
规约代码
1.[/node-type=node-name (/node-type=node-name)*] :
operation-name [( [parameter-name=parameter-value (,parameter-name=parameter-value)*] )]
[/node-type=node-name(/node-type=node-name)*]:
operation-name[([parameter-name=parameter-value(,parameter-name=parameter-value)*])]
举个例子:
Shell代码
1./profile=production/subsystem=threads/bounded-queue-thread-pool=pool1:
write-core-threads (count=0, per-cpu=20)
/profile=production/subsystem=threads/bounded-queue-thread-pool=pool1:
write-core-threads(count=0,per-cpu=20)
Tab补全代码
1.Tab补全:
2.所有的命令和参数都支持tab补全。
比如结点的类型,名字,操作名和参数名。
我们正考虑增加别名在tab补全时可以显示更少的选项,然后在后台翻译成相应的管理请求。
Tab补全:
所有的命令和参数都支持tab补全。
比如结点的类型,名字,操作名和参数名。
我们正考虑增加别名在tab补全时可以显示更少的选项,然后在后台翻译成相应的管理请求。
管理请求字符串之间的空格是不敏感的。
2.2.3.1管理资源的地址
管理请求可以不含有地址信息和参数,比如:
:
read-resource,可以列出当前Node下的所有节点类型。
在管理命令中,为了消除歧义需要以下几个前缀:
∙ " :
" ---在当前节点上执行操作,比如:
[subsystem=web]:
read-resource(recursive="true")
∙ "./" ----在当前节点的子节点上执行操作,如:
[subsystem=web]./connector=http:
read-resource
这个操作的全路径地址是:
subsystem=web,connector=http.
∙ "/"---在根节点上执行操作,如:
[subsystem=web]/:
read-resource 或子节点:
[subsystem=web]/subsystem=logging:
read-resource
2.2.3.2操作类型和操作描述列表
操作的类型可以分为在任何节点上的通用操作和在特殊节点上的特殊操作(如:
subsystem).通用的操作包括:
操作列表代码
1.add
2.remove
3.read-attribute
4.write-attribute
5.read-children-names
6.read-children-resources
7.read-children-types
8.read-operation-description
9.read-operation-names
10.read-resource
11.read-resource-description
add
remove
read-attribute
write-attribute
read-children-names
read-children-resources
read-children-types
read-operation-description
read-operation-names
read-resource
read-resource-description
对于特殊操作列表(比如在logging子系统上可以进行的特殊操作),可以通过管理的节点进行查询。
比如,查询一个单独运行服务器上logging子系统上所支持的操作:
Shell代码
1.[[standalone@localhost:
9999 /] /subsystem=logging:
read-operation-names
2.{
3. "outcome" => "success",
4. "result" => [
5. "add",
6. "change-root-log-level",
7. "read-attribute",
8. "read-children-names",
9. "read-children-resources",
10. "read-children-types",
11. "read-operation-description",
12. "read-operation-names",
13. "read-resource",
14. "read-resource-description",
15. "remove-root-logger",
16. "set-root-logger",
17. "write-attribute"
18. ]
19.}
[[standalone@localhost:
9999/]/subsystem=logging:
read-operation-names
{
"outcome"=>"success",
"result"=>[
"add",
"change-root-log-level",
"read-attribute",
"read-children-names",
"read-children-resources",
"read-children-types",
"read-operation-description",
"read-operation-names",
"read-resource",
"read-resource-description",
"remove-root-logger",
"set-root-logger",
"write-attribute"
]
}
可以看出,logging支持三个额外特殊的操作:
change-root-log-level,set-root-loggerandremove-root-logger.
进一步关于被管理节点描述或者被管理节点上操作的描述,可以通过一下命令查询:
Shell代码
1.[standalone@localhost:
9999 /] /subsystem=logging:
read-operation-description(name=change-root-log-level)
2.{
3. "outcome" => "success",
4. "result" => {
5. "operation-name" => "change-root-log-level",
6. "description" => "Change the root logger level.",
7.