Reputation: 1048
I was getting inside the folders of Glassfish, I found a folder named domains and inside it I found domain1.
My questions are:
seeing the folder domain1 make me understand that we can have domaine2, domaine3 and so on
what is the rule, do we have to have many domains?
when should we create another domain folder ?
Upvotes: 2
Views: 991
Reputation: 7710
A domain in GlassFish is basically a set of configurations that are used together in a single environment. Usually, you would need a single domain folder and it's safe to use the stock domain1
. Inside a domain you can define multiple isntances and even multiple clusters so you don't need to have more than one domain at a time.
More domains are useful when you want to switch between different configurations frequently, or as templates for varioius environments. You could have a development
domain, test
domain, production
domain, each tuned for specific environments.
For example, Payara Server, which is derived from GlassFish, adds additional payaradomain
, which is tuned for production, while the default domain1
is tuned for development as it's in GlassFish. Therefore you may easily choose the best default configuration for your needs just by switching the domain when you start the server.
Another usecase would be if you develop 2 or more unrelated applications and you want to keep them separate in the server. Then you would create a separate domain for each of them and run GlassFish with the appropriate domain so that the applications are isolated. The second domain can be configured to a different set of ports so that the servers don't collide.
Upvotes: 2