How to run multiple instances of JBoss in a one si

2019-01-16 15:26发布

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

标签: jboss
9条回答
萌系小妹纸
2楼-- · 2019-01-16 15:43

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 .

查看更多
Viruses.
3楼-- · 2019-01-16 15:47

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.

查看更多
Lonely孤独者°
4楼-- · 2019-01-16 15:49

Create multiple loopback adapters and bind each ip address to different instance.

No need of changing port.

RK

查看更多
萌系小妹纸
5楼-- · 2019-01-16 15:55

The quickest and easiest way that comes into mind is simply configuring multiple IP addresses to the hosting machine. Then you can use the different IP addresses to bind to each instance. Doing this means you don't have to change any default ports and allows for an easier environment to manage.

查看更多
等我变得足够好
6楼-- · 2019-01-16 15:58

You can make things a lot simpler by simply changing the IP that the server is bound to.

You will need to copy the entire jboss folder several times and configure run.bat to use the -b parameter on startup.

If this is a Windows server and you're running jboss as a service, you might want to edit the service.bat for each instance too so that the servers all have different names in the services control panel.

Part of the problem we ran into when trying to use different HTTP ports was that jboss uses 'lots' of ports for different purposes and it was a pain to edit all of these port numbers to be unique on each instance. By changing the bind address you can avoid this problem entirely.

查看更多
来,给爷笑一个
7楼-- · 2019-01-16 15:59

1) Copy the default folder with new name: instance name

2) In jboss-service.xml Uncomment the ServiceBindingManager mbean and change the ServerName to ports-01 or 02 or 03 e.g:ports-01 and ports-01/02/03 configuration should be there in sample-bindings.xml(present in docs/examples/binding-manager) And make the changes in all the ports mentioned under ports-01/02/03 tags, So that ports will not get conflict. Remember the server will run on the binding port like 8080/8180/8182.

from cmd promt go to the bin folder and run the instances with cmd:

run -c instancename

查看更多
登录 后发表回答