When multiple JBoss services are started on one service, the ports may conflict. If you modify the default ports one by one, it will be complicated; for this reason, JBoss provides a unified method for managing multiple instances (servicebindingmanager), the basic idea is that JBoss provides a server port binding file-xxx-bindings.xml, it defines multiple ports marked by server-name, which serves as a unified port binding configuration file. Then register a port binding service servicebindingmanager in the jboss-server.xml of each server instance, which uses parameters:
Servername: Specifies the port configuration for the xxx-bindings.xml
Storeurl: Specifies the location of the xx-bindings.xml File
Once the service is registered, the port settings of server. xml under Tomcat are ignored, and the new port configuration is enabled.
Implementation steps:
1. copy the docs \ examples \ binding-Manager \ sample-bindings.xml file to the server, rename it as a server-bindings.xml, the file has built-in port binding for four servers, so by default, you can enable at least four JBoss service instances.
2. In the JBoss \ Server \ Default \ conf \ jboss-service.xml file
<Mbean code = "org. JBoss. Services. Binding. servicebindingmanager"
Name = "JBoss. System: service = servicebindingmanager">
<Attribute name = "servername"> ports-01 </attribute>
<Attribute name = "storeurl" >$ {JBoss. Home. url}/Server/cod-bindings.xml </attribute>
<Attribute name = "storefactoryclassname">
Org. JBoss. Services. Binding. xmlservicesstorefactory
</Attribute>
</Mbean>
Remove comments and modify the name = servername values, including posts-default, posts-01, posts-02, and posts-03.
You can query port values for ports-01 In the cod-bindings.xml (if the file does not exist, copy the same version to the appropriate directory ).
3. Start each service instance. Run. Bat-C default:
./Run. Sh-C default-B 0.0.0.0
Background startup: nohup./run. Sh-C default-B 0.0.0.0>/dev/null &