Jboss Server with same port on the same machine - jboss

Can we run more than one instance of Jboss Server with same port on the same machine ? If yes how ?
Thanks
Amar

of course the only way to have two services listening on the same port is to make sure that they bind on different IP addresses. If you consider acceptable configure multiple addresses on the same interface, simply start each instance of JBoss with the flag "-b <address>"

Yes you can. All you need is to also run a Apache server instance and use it as a load balancer to a JBoss cluster and use the mod_proxy or mod_ajp plugin to load balance between multiple JBoss instances. To spin up multiple instances of JBoss 5 or JBoss 6 on Windows , use my script here (but you will have to enhance the configuration yourself to enable clustering and the Apache load balancer). Plus, my launch script requires you download stuff from the YAJSW server wrapper project.
I frequently run multiple jboss servers as a cluster and I always run a Apache server on port 80 and 443 that load balances to the JBoss instances. Here is am example post from my blog.

Yes, you can do it if your machine has several network interfaces (IP addresses) and you bind each Jboss instance to one different IP. For example, if your machines has two network interfaces: 192.168.1.1 and 192.168.1.2, you could run each instance with the command:
./run.sh -c instance1 -b 192.168.1.1
./run.sh -c instance2 -b 192.168.1.2
But the most common case is running several instances in the same machine using different ports each instance, you can achieve that with Jboss Ports Bindings.
Look for detailed info in this JBoss Web: Configuring Multiple JBoss Instances On One Machine.

Related

Dynamic port mapping for ECS tasks

I want to run a socket program in aws ecs with client and server in one task definition. I am able to run it when I use awsvpc network mode and connect to server on localhost every time. This is good so I don’t need to know the IP address of server. The issue is server has to start on some port and if I run 10 of these tasks only 3 tasks(= number of running instances) run at a time. This is clearly because 10 tasks cannot open the same port. I can manually check for open ports before starting the server and somehow write it to docker shared volume where client can read and connect. But this seems complicated and my server has unnecessary code. For the Services there is dynamic port mapping by using Application Load Balancer but there isn’t anything for simply running tasks.
How can I run multiple socket programs without having to manage the port number in Aws ecs?
If you're using awsvpc mode, each task will get its own eni and there shouldn't be any port conflict. But each instance type has a limited number of enis available. You can increase that by enabling eni trunking which, however is supported by a handful of instance types:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-instance-eni.html#eni-trunking-supported-instance-types

Jboss multiple instances in Standalone mode on same pc

We are using Jboss 7 App Server and we are trying run multiple server nodes on a single box and also on other box *basically 2 boxes which will have 2 each nodes of Jboss servers running).
My question is to have multiple nodes of Jboss Servers on a single box in Standalone mode. Should I have to copy server folder twice with port offsets?
Or is it ok to start servers just via port offset without having to copying server folder?
What is the best practice to have multiple server nodes running on the same box? Any advice would be greatly appreciated.
Thank you.
Just create multiple copies of standalone directory(Example: standalone_PROD,standalone_SIT) so that we will have separate log files and deployment directories for each instance. And use below option while starting server instance:
-Djboss.server.base.dir=/path/to/standalone_SIT <-- Location of standalone dir
-Djboss.socket.binding.port-offset=10 <-- PortOffset to avoid port conflict
We have had two instances of jboss on the same computer over several years. Both instances were in the same domain. Each instance had its own port and of course lay in its own path. Our experiences were good.
You can have as many standalone instances you want on a machine, depending upon the resources available.
All you need to do is copy over the same folder twice and make changes in all the ports to be used in the standalone mode. Also If you are setting any parameters make sure they are according to the memory available on the machine.

JBOSS AS 7 Load Balancing with Server Failover

I have 2 instances of Jboss servers running on eg: 127.0.0.1 and 127.0.0.2.
I have implemented Jboss load balancing, but am not sure how to achieve server failover. I do not have a webserver to monitor the heartbeat and hence using mod_cluster is out the question. Is there any way I can achieve failover using only the two available servers?
Any help would be appreciated. Thanks.
JBoss clustering automatically provides JNDI and EJB failover and also HTTP session replication.
If your JBoss AS nodes are in a cluster then the failover should just work.
The Documentation refers to an older version of JBoss (5.1) but it has clear descriptions of how JBoss clustering works.
You could spun up another instance to server as your domain controller, and the two instances you already have will be your hosts. Then you could go through the domain controller, and it will do the work for you. However, I haven't seen instances going down to often, it usually servers that do, and it looks like you are using just one server (i might be wrong) for both instances, so i would consider splitting it up.

How to Run Two applications on single JBoss without creating multiple instance

I have one application which listen to 1099 port.
I also have another application which refer to same port(1099).
I have deploy this two application in single JBoss.
When i run JBoss(Using jboss-6.1.0.Final) it throws an error.
Is there any other way to do this without creating another instance of JBoss?
Two processes should not be listening to the same port. You should make the ports configurable in the applications, and then use different ports for them.

jboss clustering GMS, join

I have jboss 5.1.0.
we have configured jboss somehow using clustering, but in fact we do not use clustering while developing or testing. But in order to launch the project i have to type the following:
./run.sh -c all -g uniqueclustername
-b 0.0.0.0 -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-01
but while jboss starting i able to see something like this in the console:
17:24:45,149 WARN [GMS]
join(172.24.224.7:60519) sent to
172.24.224.2:61247 timed out (after 3000 ms), retrying 17:24:48,170 WARN
[GMS] join(172.24.224.7:60519) sent to
172.24.224.2:61247 timed out (after 3000 ms), retrying 17:24:51,172 WARN
[GMS] join(172.24.224.7:60519)
here 172.24.224.7 it is my local IP
though 172.24.224.2 other IP of other developer in our room (and jboss there is stoped).
So, it tries to join to the other node or something. (i'm not very familiar how jboss acts in clusters). And as a result the application are not starting.
What may be the problem in? how to avoid this joining ?
You can probably fix this by specifying
-Djgroups.udp.ip_ttl=0
in your startup. This Sets the IP time-to-live on the JGroups packets to zero, so they never get anywhere, and the cluster will never form. We use this in dev here to stop the various developer machines from forming a cluster. There's no need to specify a unique cluster name.
I'm assuming you need to do clustering in production, is that right? Could you just use the default configuration instead of all? This would remove the clustering stuff altogether.
while setting up the server, keeping the host name = localhost and --host=localhost instead of ip address will solve the problem. That makes the server to start in non clustered mode.