payara / Payara

Payara Server is an open source middleware platform that supports reliable and secure deployments of Java EE (Jakarta EE) and MicroProfile applications in any environment: on premise, in the cloud or hybrid.
http://www.payara.fish
Other
882 stars 306 forks source link

payara clustering to different port issue #1644

Closed Chalfouh closed 7 years ago

Chalfouh commented 7 years ago

Description


Building a cluster with different ports, payara doesn't take in consideration instances ports configuration machine1 windows machine2 ubuntu cluster-config: +system properties ports : 80,81 +instance value instance1 : ports 80,81 ip:192.168.1.25
instance2: ports : 28080, 28181 ip:192.168.1.3 when i try to start the instance 2 it tries to connect to machine1 on port 28080 not 80 grizzley framework 2.3.29 could not start - unable to bind 192.168.1.25:28080 initial error message: java.netBindingException:cannot assign requested address

NOTE: if i do the same ports for all instance everything is ok

Expected Outcome

instance should start on the specified port

Current Outcome

grizzley framework 2.3.29 could not start - unable to bind 192.168.1.25:28080 payara on the target domain "instance 2" reads only the properties of the instance 2 in the domain.xml and consider them as global. apparently ${HTTP_LISTENER_PORT} returns 28080 rather than 80

Steps to reproduce (Only for bug reports)

Samples

Context (Optional)

Environment

mikecroft commented 7 years ago

Can you explain how exactly what commands you use to set the ports and what you expect to happen? I think this is a misconfiguration. The HTTP_LISTENER_PORT you specified in the question is something Payara Server generates when it is created, so it will need to be changed in the domain.xml. The new behaviour of incorporating system properties is configured differently.

Chalfouh commented 7 years ago

I did not edit manualy domain.xml all configurations are made through the payara das web admin 1-created a new cluster-config

2-i edited the system properties node changed the ports to 80 and 81 3- in the http listener i entered the ip:192.168.1.25 4- i created ssh node cluster 2 with ip 192.168.1.3 this will run on the ubuntu machine 5- i created instance1 this is the local-domain instance that has cluster-config 6- i created instance2 this is the cluster 2 instance that has cluster-config
7- i edited the system properties node again and i changed the instance port values of the cluster2 to 28080 and 28181 8- instance 1 run perfectly 9- cluster 2 has the previously mentioned error

mikecroft commented 7 years ago

OK, it's quite hard to follow your steps and figure out where you've set properties.

What do you mean by "when i try to start the instance 2 it tries to connect to machine1 on port 28080" - the instances shouldn't try to connect to each other over the HTTP ports at all.

You said "i created ssh node cluster 2 with ip 192.168.1.3" -> did you mean that you created an SSH node where instance 2 will run?

Your original error was "could not start - unable to bind 192.168.1.25:28080" so if you are getting that message on instance 2, the only solution I can see is that you have configured instance 2 to bind to the IP address and port of instance 1 which is invalid.

An instance can only bind to 0.0.0.0, 127.0.0.1 or its own IP.

Chalfouh commented 7 years ago

for simplicity here is the domain.xml of the node on ubuntu instance 2 i changed some data however the main data still the same. PLEASE NOTE AS I TOLD YOU PREVIOUSLY IF I USE THE SAME PORT FOR BOTH INSTANCE BESIDE FROM 80 EVERYTHING WORK FINE yes i created an ssh node where instance 2 will run and its ip address 192.168.1.3 i am not sure but i think it is the way of parsing domain.xml it takes a local LISTENER_PORT property as a global an it applies it on each property: say when it read the property of the instance 2 it set LISTENER_PORT=28080 and then when it read the property of instance 1 which is LISTENER_PORT=80 however it use the same LISTENER_PORT property LISTENER_PORT=28080

domain.txt

mikecroft commented 7 years ago

You've configured HTTP listener 1 to bind to the IP of instance 1. This setting will apply to the whole cluster, meaning every instance you create in this cluster, regardless of the location, will always try to bind to that IP address:

<network-listener protocol="http-listener-1" address="192.168.1.25" port="${HTTP_LISTENER_PORT}" name="http-listener-1" thread-pool="http-thread-pool" transport="tcp"></network-listener>

Change the address back to 0.0.0.0 and the problem should be resolved. This is what the bind exception means and the reason why instance 2 is saying it can't bind to an incorrect address.

mikecroft commented 7 years ago

You've also set the HTTP_LISTENER_PORT twice - you've set the default value to 80 and overridden it in clust-nb1. There's no override for that system property in clust-nb2, so it will also be set to 80.

Chalfouh commented 7 years ago

Thank you Mike for your quick answers and for your time, i really appreciated your help , the 0.0.0.0 did the trick.