facebook
Lakshminarayana Nekkanti
Senior Plugin Developer
Posted on Feb 17th 2016 The concept of “server domains” is familiar to those who use Sun related servers such as, GlassFish, WebLogic, Sun Java System Application Server (SJSAS), Payara, etc. Similar concepts are in other application servers, such as domains in JBoss and Wildfly, and profiles in WebSphere. This article is based on Sun related servers, mainly GlassFish and Payara.

What is a server domain?

A domain is set of server instances that are administered together. Each domain has a Domain Administration Server (DAS) that hosts administrative applications.

What is the role of a server domain?

  • A domain provides UI for the admin console with built in applications allowing you to easily perform administrative tasks.
  • A domain provides API for developers to run admin commands.

  • A domain provides a J2EE runtime and other runtimes for user applications that are independent of other domains.

  • A domain is security enabled, it won’t allow unauthorized persons to change configurations.

  • A domain has its own configuration data, log files, and application deployment areas that are independent of other domains. If the configuration is changed for one domain, the configurations of other domains are not affected.

ServerDomainArchitecture

 

Why do we need multiple domains?

  • To avoid classloader inferences.

  • Splitting JVM’s into different domains will give you better performance while garbage collecting.

  • You can maintain a single domain as the smallest unit so you can easily switch on and off without affecting other applications.

  • If you want two apps with different settings you need two domains.

  • An application can demand more heap than on a shared server.

  • Independent configuration for each domain. Configuration changes of one domain won’t affect other domains.

  • Domains are security enabled for different people in a single server installation. Each one can administer the instances in a single domain without affecting the instances in other domains.

  • Better CPU utilization.

  • To maintain different versions of same application.

  • Easy to implement and maintain the applications (data, logs etc.).

  • Shutdown of one domain won’t affect other domains.

  • You can host applications on domains for a separate organization.

What considerations are there when creating new domains?

  • You need to choose the ports available on the operating platform.

  • A server instance always belongs to a single domain and server instances in a single domain can run on different physical hosts.

  • Each domain has one domain administration server, and one or multiple server instances.

  • A domain contains its own configuration, log files, and application deployment areas.

What is DAS?

The Domain Administration Server (DAS) is a unique server instance that is dedicated to administrative tasks.

 

What is the role of the DAS?

  • The DAS provides administration tools two ways: command-line utilities and the browser-based Administration Console (Admin Console). It also provides a JMX-based API and ANT tasks for server administration.

  • The DAS can administer server instances running on remote hosts as well.

  • The DAS has the master copy of the configuration data for all instances in a domain. If an instance is destroyed, the instance can be recreated from the data in the DAS.

  • The DAS authenticates the administrator, accepts requests from administration tools, and communicates (using JMX) with other instances in the domain to carry out the requests from administration tools.

  • The DAS is the default Server instance in a domain. If a single instance meets your requirements, you can use the DAS for deploying applications and for administering the domain.

  • The graphical Administration Console communicates with a specific DAS to administer the domain that is associated with the DAS. Each Administration Console session enables you to configure and manage only one domain. If you create multiple domains, you must start a separate Administration Console session to manage each domain.

What is the server instance?

The server instance is a single Java EE compatible Java Virtual Machine (JVM) process.

 

What is the role of the server instance?

The default server instance provides the ability to deploy applications without administering them. If you require multiple instances, you must administer the instances explicitly.

 

What are the different type of server instances?

Server instance is one of the following types of instance:

Standalone instance—A standalone instance does not share its configuration with any other instances or clusters. A standalone instance is created if either of the following conditions is met:
  • No configuration or cluster is specified in the command to create the instance. When no configuration or cluster is specified, a copy of the default-config configuration is created for the instance. The name of this configuration is instance-name-config, where instance-name represents the name of an unclustered server instance.

  • A configuration that is not referenced by any other instances or clusters is specified in the command to create the instance.
Shared instance—A shared instance shares its configuration with other instances or clusters. A shared instance is created if a configuration that is referenced by other instances or clusters is specified in the command to create the instance.

Clustered instance—A clustered instance inherits its configuration from the cluster to which the instance belongs and shares its configuration with other instances in the cluster. A clustered instance is created if a cluster is specified in the command to create the instance.

Any instance that is not part of a cluster is considered an unclustered server instance. Therefore, standalone instances and shared instances are unclustered server instances.

 

What is a cluster?

A cluster is a collection of server instances that share the same applications, resources, and configuration information.

 

What is the role of a cluster?

  • A cluster provides high availability through failure protection, horizontal scalability, and load balancing.

  • A cluster simplifies the administration process by controlling the lifecycle of each server instance.

  • A cluster maintains the one configuration for each server instance.

  • A cluster automatically pushes the application to each server instance, eliminating the need to deploy it to each server instance.

  • A cluster provides a runtime environment for one or more Java Platform, Enterprise Edition (Java EE) applications.

What is a node agent?

A node agent is a lightweight process running on the physical server that hosts server instances. The node agent is responsible for managing the lifecycle of these server instances.

 

What is the role of a node agent?

  • Creating and initializing the server instance by retrieving the configuration information from the DAS repository on the physical host.

  • Starting, stopping, and restarting server instances as instructed by the DAS.

  • Providing diagnostic information about the lifecycle change events that occurred to server instances, such as a failure.

  • Synchronizing each server instance’s local configuration repository with the DAS’s central repository.

  • Performing appropriate cleanup when a server instance is deleted.

  • If the node agent crashes, it does not affect the server instances and user applications that are currently running. However, a failed node agent can no longer manage and monitor those server instances.

Case Study: Domain Management with the GlassFish Server

Now that we’ve covered server domain concepts, let’s do a domain specific case study, covering domain creation and management with GlassFish.

GlassFish Server

When you install GlassFish, a default domain, domain1 is created. This domain has a single server instance that provides both administrative and application services.

The default ports for the default domain are as follows:

Service

Port

Admin 4848
HTTP 8080
Java Messaging System (JMS)7676
Internet Inter-ORB Protocol (IIOP)3700
Secure HTTP (HTTPS)8181
Secure IIOP3820
Mutual Authorization IIOP3920
Java Management Extensions (JMX) administration8686

 

Create a GlassFish Domain

The default domain, domain1, creates the GlassFish installation. You can create your own domain using the create-domain subcommand.

These are the prerequisites to create a domain.

  • Determine which profile will apply to the domain.

  • Determine a unique name for the domain.

  • Use either the admin username and password for the domain or use the default admin username without password option.

    Open asadmin command from ${GlassFish Installation dir}\GlassFish\bin.

IMG-1

 

Create the Domain in the Default Location

Type `create-domain –adminport 4848 domain1` to create the domain domain1. You can choose any unique name.

DSImg-2

 

Note: After typing the create-domain command, you can choose your own username and password. Otherwise, it will create domain with the default username admin with no password.

Create the Domain in a Non-Default Location

Type `create-domain –domaindir <custom location>` to create a domain in a non-default location.

DSImg-3

 

Create the Domain with Saving Credentials

The username and password are stored in the .asadminpass file in the user’s home directory. A domain can only be created locally. Therefore, when using the –savelogin option, the host name saved in .asadminpass is always localhost.

DSImg-4

 

Create the Domain with Keytool Options

You can specify an optional list of name-value pairs of keytool options for a self-signed server certificate. The certificate is generated during the creation of the domain. Each pair in the list must be separated by the colon (:) character.

CN—Specifies the common name of the host that is to be used for the self-signed certificate. This option name is case insensitive. By default, the name is the fully-qualified name of the machine where the create-domain subcommand is run.

DSImg-5

 

Start a GlassFish Domain

To start domain1 use the start-domain command; e.g., `start-domain domain1`.

DSImg-6

 

Stop a GlassFish Domain

To stop running domain1 use the stop-domain command; e.g., `stop-domain domain1`.

DSImg-7

 

Delete a GlassFish Domain

To delete a domain under a non-default domain directory use the delete-domain command; e.g., `delete-domain –domaindir d:/domains domain2`.

DSImg-8

 

To delete a domain under the default domain directory use delete-domain command; e.g., `delete-domain customdomain`.

DSImg-9

 

List GlassFish Domains

To list domains in the default domain directory use the list-domains command.

DSImg-10

 

Let Us Hear from You!

If you have any comments or questions, we would love to hear from you @MyEclipseIDE on twitter or via the MyEclipse forum