wildfly21的配置文件和资源管理

wildfly21的配置文件和资源管理

2023年7月3日发(作者:)

wildfly21的配置⽂件和资源管理简介在上⼀篇⽂章我们介绍了wildfly 21的基本使⽤和管理界⾯。今天我们将会详细讲解⼀下wildfly的配置⽂件和资源管理。wildfly的配置⽂件不管是在standalone还是在domain模式下,有两个配置⽂件是⾮常重要的,他们是和。其他的standalone-*.xml可以参考来配置我们看下的⼤体结构:......... ... ...server主要有5部分,分别是extensions,management,profile,interfaces和socket-binding-group。extensionsextensions表⽰的是核⼼应⽤程序之外的module。因为有了这些外部的module,所以wildfly核⼼应⽤程序是⾮常简单和轻量级的。这些外部的module是放在modules⽂件夹的。我们可以通过使⽤extension标签来引⽤他们: [...] [...] profileprofile是由多个subsystem组成的。subsystem是通过extension添加到核⼼服务器的⼀组新增的功能。我们看⼀个profile和subsystem的例⼦: 上⾯的代码配置了⼀个jboss:domain:logging,设置了⽇志的格式,⽇志级别等信息。基本上和中的profile的内容是⼀样的,不同的是中可以配置多个profile,⽽只能有⼀个profile。path在上⾯的⽇志配置中,我们在periodic-rotating-file-handler 中使⽤了 file的path属性。需要在path属性中指定⽇志⽂件的位置。这⾥我们使⽤的是,实际上wildfly中有很多内置的path变量: - WildFly的root⽬录 - ⽤户的home⽬录 - ⽤户的当前⼯作⽬录 - java安装⽬录 - server实例的root⽬录 - server实例的配置⽂件⽬录 - server实例的数据⽬录 - server实例的⽇志⽬录 - server实例的temp⽬录 - controller实例的temp⽬录 - 在managed domain模式下,host controller为servers创建的⼯作⽬录除了最上⾯的5个路径之外,⽤户可以⾃定义或者重写其他的内置路径:其中name表⽰的是path的名字,path是路径的值,如果没有relative-to就是绝对路径,带上relative-to就是相对路径。relative-to表⽰的是相对路径的基准。上⾯的格式只能在⽂件中使⽤。如果要在中使⽤则必须下⾯的格式:这⾥的name只是对⽂件中的path定义的⼀个引⽤:interfaceiterface表⽰的是⽹络接⼝,可以是hostname也可以是IP地址,是给后⾯的sockets绑定使⽤的。我们看⼀个interface的例⼦: 同样的,如果是在中的interface标签只能包含name属性:这个引⽤是定义在中的。socket-bindingsocket-binding定义的是⽹络的出⼝,通过指定绑定的ip和接⼝,最终可通过该地址来访问相应的服务: 上⾯的例⼦中,我们定义了ajp,http,https的地址,并且还有⼏个管理端,事务,邮件的地址。注意,我们有⼀个属性叫做port-offset,这个可以设置标准接⼝的偏移量,特别⽅便在标准接⼝被占⽤的情况下使⽤。⽐如,我们默认的http端⼝是8080,如果这个端⼝已经被占⽤了,那么我们可以传⼊⼀个port-offset= 100,这样http端⼝就变成了8180,⾮常⽅便。managementmanagement是对wildfly管理端的配置,我们知道可以通过wildfly的web端或者cli端进⾏wildfly的管理。我们看下management的定义: 上⾯的例⼦中,我们通过management-interfaces指定了管理端的访问地址,和要使⽤到的安全策略。在security-realms中,我们可以定义多种security-realm。在security-realm中可以定义⽤户信息和group信息。资源管理./bin/ are disconnected at the moment. Type 'connect' to connect to the serveror 'help' for the list of supported commands.[disconnected /]

[disconnected /] connect[standalone@localhost:9990 /]web端⼤家应该都很清楚怎么使⽤,这⾥重点介绍⼀下命令⾏端的使⽤情况。我们通过help --commands可以拿到命令⾏状态下可以执⾏的命令:attachment deployment enable-all module security enable-http-auth-http-serverbatch deployment info patch apply security enable-http-auth-managementcd deployment list patch history security enable-sasl-managementclear deployment undeploy patch info security enable-ssl-http-servercommand deployment undeploy-cli-archive patch inspect security enable-ssl-managementcommand-timeout deployment-info pwd security reorder-sasl-managementconnect deployment-overlay quit setconnection-info echo read-attribute shutdowndata-source echo-dmr read-operation trydeploy for reload undeploydeployment deploy-cli-archive grep run-batch unsetdeployment deploy-file help security disable-http-auth-http-server versiondeployment deploy-url history security disable-http-auth-management xa-data-sourcedeployment disable if security disable-sasl-managementdeployment disable-all jdbc-driver-info security disable-ssl-http-serverdeployment enable ls security disable-ssl-management除此之外,命令⾏还对资源提供了⼀系列的操作符来对资源进⾏操作。在wildfly中,可管理的对象都被看做是⼀个⼀个的资源,我们可以通过资源的路径来访问到这个资源。⽐如,我想看⼀下server下⾯名字是default-server的资源,则可以这样: /server=default-server

资源路径可以连写,⽐如:/subsystem=undertow/server=default-server/http-listener=default这些都是有效的资源路径。有了资源路径,我们还需要提供操作符来对资源进⾏操作,wildfly提供了下⾯的操作符:addread-attributeread-children-namesread-children-resourcesread-children-typesread-operation-descriptionread-operation-namesread-resourceread-resource-descriptionremovevalidate-addresswrite-attribute我们可以在操作符前⾯加上冒号,来具体使⽤他们:/subsystem=logging:read-operation-names上⾯的例⼦将会获取对logging⼦系统的操作符:{ "outcome" => "success", "result" => [ "add", "list-add", "list-clear", "list-get", "list-log-files", "list-remove", "map-clear", "map-get", "map-put", "map-remove", "query", "read-attribute", "read-attribute-group", "read-attribute-group-names", "read-children-names", "read-children-resources", "read-children-types", "read-log-file", "read-operation-description", "read-operation-names", "read-resource", "read-resource-description", "remove", "undefine-attribute", "whoami", "write-attribute" ]}总结本⽂讲解了wildfly的配置⽂件和资源管理相关的操作,希望⼤家能够喜欢。本⽂作者:flydean程序那些事本⽂来源:flydean的博客欢迎关注我的公众号:「程序那些事」最通俗的解读,最深刻的⼲货,最简洁的教程,众多你不知道的⼩技巧等你来发现!

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688384958a130076.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信