2

Does anyone have any experience or advice in setting up multiple JBoss 5.1.x instances on the same machine that has 1 network card?

Here is what I did:

  1. Installed JBoss 5.1.0.GA into c:\myjboss 1.5. I copied the server/default directory to server/ports-01 and server/ports-02 so they have their own config. did I assume correctly?
  2. Ran .\run.bat -c ports-01
  3. Ran .\run.bat -c ports-02

At this point there are 2 instances but the second instance doesn't load correctly because of what is probably a few port conflicts. For example: the http port ends up being 8080 for both instances, which it gets from line #49 in the C:\myjboss\server\all\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml file. Earlier in the server load it clearly gets the value from line#63 in that same file. I don't know why it gets part of the port config from line #49 and the other part from line#63. Confused.

I also tried: .\run.bat -Djboss.service.binding.set=ports-01 -c ports-01 and it made little difference.

Any ideas on what I am doing wrong?

5 Answers 5

1

I got it working on my own. The answer were these commands:

.\run.bat -Djboss.service.binding.set=ports-01 -c ports-01

.\run.bat -Djboss.service.binding.set=ports-02 -c ports-02

Also, I had to copy the server/default to 2 new directories called server/ports-01 and server/ports-02 ...

Then , in the server\ports-01\conf\bindingservice.beans\META-INF I had to remove references to instances ports-02, ports-03, and "default" from it.

Then , in the server\ports-02\conf\bindingservice.beans\META-INF I had to remove references to instances ports-01, ports-03, and "default" from it.

Then, finally, I deleted the "standard", "web", and "default" directories from the default installation in the server directory.

Then, I ran both servers with the commands above, and out-of-the-box, they work.

Also, here is a batch file to run clustered instead of separate instances:

@echo off

start .\bin\run.bat -c ports-01 -g MyLocal -u 239.255.100.100 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-01

@echo Wait until first server finishes starting and then hit 
@echo any key to start the second server in the cluster...
pause

start .\bin\run.bat -c ports-02 -g MyLocal -u 239.255.100.100 -b 127.0.0.1 -Djboss.messaging.ServerPeerID=2 -Djboss.service.binding.set=ports-02
1
  • that was very useful info.
    – user19959
    Jun 25, 2010 at 4:58
1

You can also configure multiple jboss instances renaming run.bat and creating a new run.bat running -c instance-name . Then, you'll be able to start Jboss as service and calling run.bat properly.

1
  • how does that handle the peerID for the clustering? it seems like you need to pass the peerId option for that to work.
    – djangofan
    May 24, 2010 at 17:40
0

Instead of using the BindingManager, you can assign more than one adress to your network interface (at least if you're in control of your network) and let each jboss instance run using its own adress (using the -b option to run.(bat|sh)). This is also possible on the local loopback interface (127.0.0.1, 127.0.0.2, ...).

0

Quick follow up to Mafro's post about multiple IP addresses - depending on how MANY instances you want to run on a single host, the multiple IP addressing scheme may be the most stable. Once you start getting to 4-5 JBoss instances on a single host (and also depending on which J2EE services you've got enabled in your app, if any) you may soon run into port conflict issues when you use the "ports" implementation.

Multiple IP addresses will allow you to run all of your J2EE and JBoss services on their default ports, and avoid many of the "hunting down a port conflict scenarios" you encounter when running more than one instance.

A final note, according to the JBoss wiki, using multiple IP addresses is the "preferred solution" especially for Production environments - http://community.jboss.org/wiki/ConfiguringMultipleJBossInstancesOnOnemachine. See that link for additional resources on using the Binding Manager to configure JBoss services and applications to avoid conflicts.

3
  • nice link, thanks. aside from the document, how exactly do you establish a second IP address on the same network adapter? how would i assign a second static public IP?
    – djangofan
    Jan 20, 2010 at 20:52
  • Here's a guide for windows: itsyourip.com/networking/…
    – mafro
    Jan 21, 2010 at 7:30
  • It's not a definitive guide, but I found a pretty good explanation of not only how to do it, but why it works this way on the Linux Help Blog - linuxhelp.blogspot.com/2005/05/… Mar 1, 2010 at 18:51
0

If you don't use RMI or remoting, you can actually tweak the configuration of jboss to only use one port. It is very annoying work to do (tons of configuration files), but possible if you really need to.

To do so: - remove all services that you don't use - if you can't remove an invoker, you can probably set transport="local" so it will use in memory transport - set the ports of the remaining service to -1 - Set the following system properties to disable arjuna management ports: com.arjuna.ats.arjuna.coordinator.transactionStatusManagerEnable=NO com.arjuna.ats.arjuna.recovery.recoveryListener=NO

Configuration files you absolutely need to change: - jboss-service.xml - disable all services you don't need - legacy-invokers-service.xml (remove legacy services if possible) - messaging/messaging-bisocket-service.xml : change transport to local instead of bisocket

There will be a few more files.

What is left is a jboss which listens to the web port and one other randomly chosen port for which i don't yet know the use. This will make it easy to run multiple instances on one host.

1
  • would love to have more info on this theory... running JBoss with only 1 port would be quite nice I think. my company has completely hand-rolled apps with our own separate service ports and so being able to turn off most of the JBoss ports would be awesome.
    – djangofan
    Feb 22, 2010 at 18:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .