users@glassfish.java.net

Re: Domains and port allocations

From: <forums_at_java.net>
Date: Fri, 9 Sep 2011 12:40:48 -0500 (CDT)

The idea is that, unless you say not to, asadmin will check and see if ports
are in use before blindly assigning them.  It will even do this on remote
machines - it will see if ports can be connected to.  If the port of
interest is in use either the command will fail or a different port will be
assigned based on the context.

Clusters do not have ports because clusters are not servers they are
administrative wrappers of servers.  what we do here is assign the ports in
the configuration for the cluster.  The first instance in the cluster will
use those ports.  Each successive instance will override the port number in
its instance-level configuration (if it is on the same machine).  Thankfully
this is all done meticulously and automatically for you when you create
instances.  The other instances do NOT need to be running for safe port
assignment.

You can sit at a console for a few minutes and see exactly how all of this
works very easily.  Try this:

asadmin start-domain domain1 // now all the standard ports are in use

asadmin create-domain --no-password d2
Domain d2 created.
Domain d2 admin port is 52304.
Domain d2 allows admin login as user "admin" with no password.
 

Since the "stock" ports were active it chose some random ports for you so
both domains can both run simultaneously.

If you had created the domain with domain1 NOT running it would have chosen
the stock port numbers and then you couldn't run both domains at the same
time.

asadmin create-domain --portbase 25000 --nopassword d3
asadmin create-domain --portbase 25000 --nopassword d4

-- Since you didn't start d3 -- d4 will use the exact same ports.

asadmin create-domain --portbase 25000 --nopassword d3
asadmin start-domain d3
asadmin create-domain --portbase 25000 --nopassword d4
** ERROR ** port conflict

Why doesn't GlassFish simply look inside the configuration of non-running
domains?  Why does it only check for live port usage?

Because the "Universe" of GlassFish is at the domain level.  There is no
concept above the domain.  We don't know if, for istance, you happen to have
domains that are never used etc. 

 


--
[Message sent by forum member 'bnevins']
View Post: http://forums.java.net/node/841337