Sun GlassFish Enterprise Server v2.1.1 Administration Guide

Basic Enterprise Server Commands

Administration of the Enterprise Server includes tasks such as creation, configuration, control and management of domains, clusters, node agents, and server instances. This section contains the following topics:

Creating a Domain

Domains are created using the create-domain command. The following example command creates a domain named mydomain. The administration server listens on port 5000 and the administrative user name is admin. The command prompts for the administrative and master passwords.


$ asadmin create-domain --adminport 5000 --adminuser admin mydomain

To start the Admin Console for mydomain domain, in a browser, enter the following URL:


http://hostname:5000

In Enterprise Server 9.1, every domain has a profile associated with it. For information on profiles, see Usage Profiles. You can choose the profile of a domain only during creation. Use the --profile option with the create-domain command to specify a profile for the domain. If you do not use the --profile option to explicitly specify a profile, the default profile is associated with the domain. The AS_ADMIN_PROFILE variable in the asadminenv.conf file defines the default profile.


Caution – Caution –

Do not create an enterprise domain unless you have HADB and the Network Security Services (NSS) keystore. You will not be able to start an enterprise domain unless you have HADB and NSS.


For the preceding create-domain example, the domain’s log files, configuration files, and deployed applications now reside in the following directory:

domain-root-dir/mydomain

To create the domain’s directory in another location, specify the --domaindir option. For the full syntax of the command, type asadmin help create-domain or the create-domain(1).

Deleting a Domain

Domains are deleted using the asadmin delete-domain command. Only the operating system user (or root) who can administer the domain can execute this command successfully. To delete a domain named mydomain, for example, type the following command:


$ asadmin delete-domain mydomain

Listing Domains

The domains created on a machine can be found using the asadmin list-domains command. To list the domains in the default domain-root-dir directory, type this command:


$ asadmin list-domains

To list domains that were created in other directories, specify the --domaindir option.

Starting the Domain

When starting a domain, the administration server and application server instance are started. Once the application server instance is started it runs constantly, listening for and accepting requests. Each domain must be started separately.

To start a domain, type the asadmin start-domain command and specify the domain name. For example, to start the default domain (domain1), type the following:


$ asadmin start-domain --user admin domain1

If there is only one domain, omit the domain name. For the full command syntax, type asadmin help start-domain. If the password data is omitted, you are prompted to supply it.

Starting the Default Domain on Windows

From the Windows Start Menu, select Programs -> Sun Microsystems -> Enterprise Server -> Start Admin Server.

Stopping the Domain

Stopping a domain shuts down its administration server and application server instance. When stopping a domain, the server instance stops accepting new connections and then waits for all outstanding connections to complete. This process takes a few seconds because the server instance must complete its shutdown process. While the domain is stopped, the Admin Console or most asadmin commands cannot be used.

To stop a domain, type the asadmin stop-domain command and specify the domain name. For example, to stop the default domain (domain1), type the following:


$ asadmin stop-domain domain1

If there is only one domain, then the domain name is optional. For the full syntax, type asadmin help stop-domain.

Consult the Admin Console online help to stop the domain through the Admin Console.

Stopping the Default Domain on Windows

From the Start menu select Programs -> Sun Microsystems -> Enterprise Server-> Stop Admin Server.

Restarting the Domain

Restarting the server is the same as restarting the domain. To restart the domain or server, stop and start the domain.

Creating a Cluster

A cluster is created using the create-cluster command. The following example creates a cluster named mycluster. The administration server host is myhost, the server port is 1234, and the administrative username is admin. The command prompts for the administrative passwords.


$ asadmin create-cluster --host myhost --port 1234 --user admin mycluster

For the full syntax, type asadmin help create-cluster.

Starting a Cluster

A cluster is started using the start-cluster command. The following example starts the cluster named mycluster. The command prompts for the administrative passwords.


$ asadmin start-cluster --host myhost --port 1234 --user admin mycluster

For the full syntax, type asadmin help start-cluster.

Stopping a Cluster

A cluster is stopped using the stop-cluster command. The following example stops the cluster named mycluster. The command prompts for the administrative passwords.


$ asadmin stop-cluster --host myhost --port 1234 --user admin mycluster

myhost is the administrative server host, 1234 is the administrative port, admin is the administrative username.

For the full syntax, type asadmin help stop-cluster. When a cluster is stopped, all the server instances in the cluster get stopped. A cluster without instances cannot be stopped.

Creating a Node Agent

A node agent is created using the create-node-agent command. The following example creates node agent named mynodeagent. The administration server host is myhost, the administration server port is 1234, and the administrative username is admin. The command normally prompts for the administrative passwords; however, if the --savemasterpassword option is not specified or false, the command does not prompt for the administrative passwords.


$ asadmin create-node-agent --host myhost --port 1234 --user admin mynodeagent

For the full syntax, type asadmin help create-node-agent.

Starting a Node Agent

A node agent is started using the start-node-agent command and specifying the node agent name. For example, to start the node agent mynodeagent, type the following:


$ asadmin start-node-agent --user admin mynodeagent

For the full syntax, type asadmin help start-node-agent.

Stopping a Node Agent

A node agent is stopped using the stop-node-agent command and specifying the node agent name. For example, to stop the node agent mynodeagent, type the following:


$ asadmin stop-node-agent mynodeagent

For the full syntax, type asadmin help stop-node-agent.

Starting an Instance

A server instance is started using the start-instance command. The following example starts the server instance named myinstance. The command prompts for the administrative passwords.


$ asadmin start-instance --host myhost --port 1234 --user admin myinstance

The administrative server host is myhost, the administrative port is 1234, the administrative username is admin. The server instance myinstance can be clustered or standalone.

For the full syntax, type asadmin help start-instance.

Stopping an Instance

A server instance is started using the stop-instance command. The following example stops the server instance named myinstance. The command prompts for the administrative passwords.


$ asadmin stop-instance --host myhost --port 1234 --user admin myinstance

The administrative server host is myhost, the administrative port is 1234, the administrative username is admin. The server instance myinstance can be clustered or standalone.

For the full syntax, type asadmin help stop-instance.

Restarting an Instance

To restart server instance, stop and start the instance.

Recreating the Domain Administration Server

For mirroring purposes, and to provide a working copy of the Domain Administration Server (DAS), you must have:


Note –

You must maintain a backup of the DAS from the first machine. Use asadmin backup-domain to backup the current domain.


ProcedureTo migrate the DAS

The following steps are required to migrate the Domain Administration Server from the first machine (machine1) to the third machine (machine3).

  1. Install the application server on the third machine just as it is installed on the first machine.

    This is required so that the DAS can be properly restored on the third machine and there are no path conflicts.

    1. Install the application server administration package using the command-line (interactive) mode. To activate the interactive command-line mode, invoke the installation program using the console option:


      ./bundle-filename -console

      You must have root permission to install using the command-line interface.

    2. Deselect the option to install default domain.

      Restoration of backed up domains is only supported on two machines with same architecture and exactly the same installation paths (use same as-install and domain-root-dir on both machines).

  2. Copy the backup ZIP file from the first machine into the domain-root-dir on the third machine. You can also FTP the file.

  3. Execute asadmin restore-domain command to restore the ZIP file onto the third machine:


    asadmin restore-domain --filename domain-root-dir/sjsas_backup_v00001.zip domain1

    You can backup any domain. However, while recreating the domain, the domain name should be same as the original.

  4. Change domain-root-dir/domain1/generated/tmp directory permissions on the third machine to match the permissions of the same directory on first machine.

    The default permissions of this directory are: ?drwx------? (or 700).

    For example:

    chmod 700 domain-root-dir/domain1/generated/tmp

    The example above assumes you are backing up domain1. If you are backing up a domain by another name, you should replace domain1 above with the name of the domain being backed up.

  5. Change the host values for the properties in the domain.xml file for the third machine:

  6. Update the domain-root-dir/domain1/config/domain.xml on the third machine.

    For example, search for machine1 and replace it with machine3. So, you can change:

    <jmx-connector><property name=client-hostname value=machine1/>...

    to:

    <jmx-connector><property name=client-hostname value=machine3/>...
  7. Change:

    <jms-service... host=machine1.../>

    to:

    <jms-service... host=machine3.../>
  8. Start the restored domain on machine3:


    asadmin start-domain --user admin-user --password admin-password domain1
  9. Change the DAS host values for properties under node agent on machine2.

  10. Change agent.das.host property value in as-install/nodeagents/nodeagent/agent/config/das.properties on machine2.

  11. Restart the node agent on machine2.


    Note –

    Start the cluster instances using the asadmin start-instance command to allow them to synchronize with the restored domain.