How to run multiple instances of JBoss in a one single machine?

前端 未结 9 1588
眼角桃花
眼角桃花 2020-12-07 23:30

I need to run multiple(more than 4) instances of JBoss server on a single machine. I am using JBoss 4.2.3 GA.

相关标签:
9条回答
  • 2020-12-08 00:26

    Running multiple instances of JBoss on the same server:

    1. We should keep the "default" instance same as it is under the **JBOSS_HOME\Server
    2. Copy the default folder with new name (instance name) say default2 under JBOSS_HOME\Server. Copy all the contents from JBOSS_HOME\Server\default to this newly created folder.
    3. The binding service manager needs to be enabled in conf/jboss-service.xml for instances that are not using the default ports. a. (i.e.) In the copied instance, go to conf folder under JBOSS_HOME\Server\default2 directory. Edit the jboss-service.xml. b. Search for mbean code="org.jboss.services.binding.ServiceBindingManager" in this configuration file. c. By default this xml tag is commented. We have to uncomment it and change the value ports-00 to ports-01.
    4. In the same file, Under "Socket transport Connector", in the "Configuration" section, serverBindPort must be changed to another value or it will conflict with the default (4446).

      <mbean code="org.jboss.remoting.transport.Connector"
      name="jboss.remoting:service=Connector,transport=socket"
      display-name="Socket transport Connector">
      ...
      <attribute name="Configuration">
      ...
      <attribute name="serverBindPort">25447</attribute>
      

      ...

    5. In default2/deploy/ejb3.deployer/META-INF/jboss-service.xml, for the remoting.transport.Connector mbean, port 3873 must be changed to another value or it will conflict with the default.

         <mbean code="org.jboss.remoting.transport.Connector"
            name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">
        <depends>jboss.aop:service=AspectDeployer</depends>
        <attribute name="InvokerLocator">socket://${jboss.bind.address}:25874</attribute>
       ...
      

    6. In default2\deploy\jboss-web.deployer\server.xml

    set redirect port value to the one configured in step 4

    <Connector port="8180" address="${jboss.bind.address}" 
    maxThreads="250" maxHttpHeaderSize="8192"
    emptySessionPath="true" protocol="HTTP/1.1"
    enableLookups="false" redirectPort="25447" acceptCount="100" 
    connectionTimeout="20000" disableUploadTimeout="true" />
    

    Also, the port value configured in step 5

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="25010" address="${jboss.bind.address}" protocol="AJP/1.3" //change the connector port value to avoid conflict
    emptySessionPath="true" enableLookups="false" redirectPort="25874" /> // port value configured in step 5
    

    In summary, the directory structure for setting up two other instances would be something like the below with modifications in the filenames in bold.

    $JBOSS_HOME/server/default

    $JBOSS_HOME/server/default2

    $JBOSS_HOME/server/default2/conf/jboss-service.xml

    $JBOSS_HOME/server/default2/deploy/ejb3.deployer/META-INF/jboss-service.xml

    $JBOSS_HOME/server/default2/deploy/jboss-web.deployer/server.xml**

    $JBOSS_HOME/server/default3

    $JBOSS_HOME/server/default3/conf/jboss-service.xml

    $JBOSS_HOME/server/default3/deploy/ejb3.deployer/META-INF/jboss-service.xml

    $JBOSS_HOME/server/default3/deploy/jboss-web.deployer/server.xml**

    7.From command prompt go to the bin folder and run the instances with cmd:

    run -c instancename

    In this case, it is: run -c default2

    And applications accessed with url’s like:

    http://localhost:8080/myapp/
    http://localhost:8180/myapp/
    http://localhost:8280/myapp/
    

    Note: We can go for maximum of 3 instances with this way. To run more than this we have to add some more running tags in JBOSS_HOME\docs\examples\binding-manager\sample-bindings.xml.

    0 讨论(0)
  • 2020-12-08 00:27

    I used this article to install mine. http://wiki.adempiere.net/Setup_2_Adempiere_JBoss_server_in_1_physical_server

    You should create different services to control the adempiere servers.

    Also if you work with jasper report, use unique file names for reports or you will face permission denied exception.

    Ex : if you attach "report.jrxml" to two servers. Server will create /tmp/report.jrxml tmp file.

    The second server will also try to create the same file and get crashed

    0 讨论(0)
  • 2020-12-08 00:28

    We can easily do this on JBOSS EAP For first instance, just start the JBOSS as it is.

    for the second instance, Copy the JBOSS home folder to a different location.

    go to standalone/configuration/standalone.xml. go to the section(at bottom of the file) and set port-offset value to some value(EX: 10000) which doesn't have any port binding issue on currently running application. Here the default port-offeset value is 0.

    start the second instance as usual .

    0 讨论(0)
提交回复
热议问题