Server Lifecycle

This chapter describes how to start and close a server and check the server lifecycle.

1. Preparing to Start the Server

Complete the following tasks to prepare for server startup.

  • JEUS must be installed and domains and servers must be created. A user name and password for starting and stopping the server must also be created in advance. If this task is not complete, set up the environment by following the steps in JEUS Installation and Getting Started Guide.

  • Confirm that the JVM configuration for the server is configured in the xml file.

    Changing JVM settings requires a server restart. If it is not configured when the domain is created, start MASTER to change the settings and then apply them by restarting MASTER.

    If JVM settings are missing for an MS, start the server after adding JVM settings through WebAdmin or jeusadmin. Refer to Changing a Server’s JVM Settings for the modification method.

  • Confirm that a server has an appropriate license.

2. Starting Servers

This section describes how to start the Master Server (MASTER) and a Managed Server (MS).

2.1. Starting the Master Server (MASTER)

The startMasterServer script is used to start MASTER. It requires the domain name of MASTER as well as a user name and password with the authority to start JEUS.

All three options are required if it is run from JEUS_HOME/bin. The domain name can be omitted if it is run from the DOMAIN_HOME path on MASTER.

Run the script depending on the execution path.

  • JEUS_HOME/bin

    JEUS_HOME/bin$ startMasterServer -domain <domain_name> -u <user_name> -p <password>
  • DOMAIN_HOME/bin

    DOMAIN_HOME/bin$ startMasterServer -u <user_name> -p <password>
  • SERVER_HOME/bin

    SERVER_HOME/bin$ startMasterServer -u <user_name> -p <password>

Once the MASTER’s state becomes RUNNING, server log is recorded in the file, SERVER_HOME/logs/JeusServer.log. To monitor the server log in console tool, use the -verbose option. The server process and the launcher process both run on MASTER. The launcher process runs the server process and outputs logs to the console tool.

Use the jps command to check LauncherBootStrapper and MasterServerBootstrapper.

jps -l
399092 jeus.server.LauncherBootstrapper
399352 jeus.server.admin.MasterServerBootstrapper
409880 sun.tools.jps.Jps

If the server fails to start, check the cause in SERVER_HOME/logs/JeusLauncher.log.

  1. Jps is a tool, which is in the JAVA_HOME/bin directory, that lists the Java processes.

  2. For detailed information about the Launcher, refer to Launcher in JEUS Server Guide.

2.2. Starting a Managed Server (MS)

An MS can be started using a script installed in a machine where the MS is located. If multiple servers are distributed on multiple machines in the domain, run the script on each machine that hosts the MS. The name of the script is startManagedServer, and masterurl setting must be configured in order to synchronize the settings with MASTER.

Using a Script

An MS can be started using a script instead of MASTER.

If multiple servers are distributed on multiple machines in the domain, run the script on each machine that hosts the MS. The name of the script is startManagedServer, and masterurlsetting must be configured in order to synchronize the settings with MASTER.

If masterurl is not configured, MS will start in the INDEPENDENT mode. After MASTER finds the MS, it is managed by MASTER. If MASTER has not started, masterurl can be omitted so that the MS can start in the INDEPENDENT mode. Otherwise, it is recommended to configure masterurl. For detailed information about INDEPENDENT mode, refer to Managed Server (MS) in INDEPENDENT Mode.

The following shows how to execute the startManagedServer script from different locations.

  • JEUS_HOME/bin

    JEUS_HOME/bin$ startManagedServer -masterurl <master_ip:master_baseport>
    -domain <domain_name> -server <server_name> -u <user_name> -p <password>
  • DOMAIN_HOME/bin

    DOMAIN_HOME/bin$ startManagedServer -masterurl <master_ip:master_baseport> 
    -server <server_name> -u <user_name> -p <password>
  • SERVER_HOME/bin

    SERVER_HOME/bin$ startManagedServer -masterurl <master_ip:master_baseport> -u <user_name> -p <password>

3. Shutting Down Servers

This section describes how to shut down the Master Server (MASTER) and a Managed Server (MS).

3.1. Shutting Down the Master Server (MASTER)

To shut down the MASTER, use either the console tool (jeusadmin) or a script.

Using the Console Tool

MASTER can be shut down after stopping all managed servers (refer to Shutting Down a Managed Server (MS)). Run the following local-shutdown command.

[MASTER]domain1.adminServer>local-shutdown
Using a Script

Use a script installed in a machine where the MASTER is located. Run the following stopServer script depending on the location.

  • JEUS_HOME/bin

    JEUS_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password> 
  • DOMAIN_HOME/bin

    DOMAIN_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password> 
  • SERVER_HOME/bin

    SERVER_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password> 

3.2. Shutting Down a Managed Server (MS)

An MS can be shut down using either MASTER or a script.

Using MASTER

An MS can be shut down through MASTER by using the console tool (jeusadmin).

Managed servers can be shut down by MASTER using the stop-server command in jeusadmin, as shown in the following example. For detailed information about the stop-server command, refer to stop-server in JEUS Reference Guide.

[MASTER]domain1.adminServer>stop-server <server_list>
Using a Script

An MS can be shut down using a script which is installed on the server. If multiple servers are distributed on multiple machines in the domain, run the script on each machine that hosts the MS.

Run the following stopServer script depending on the location.

  • JEUS_HOME/bin

    JEUS_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password>
  • DOMAIN_HOME/bin

    DOMAIN_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password>
  • SERVER_HOME/bin

    SERVER_HOME/bin$ stopServer -host <server_ip:server_baseport> -u <user_name> -p <password>

4. Checking Server Lifecycle

MASTER determines the lifecycle of the managed servers.

figure server lifecycle
Server Lifecycle

The following describes each state.

State Description

SHUTDOWN

Server has not been started or has been shut down normally.

STARTING

Server is in the startup process, but is not ready to run services.

STANDBY

The server is not in the RUNNING state yet because some applications failed to be distributed during startup. Modify the problematic application or use the force option with the start command to ignore the error and start the server.

RUNNING

Server is running and is ready to provide services.

SHUTTING_DOWN

Server is shutting down.

SUSPENDING

Server, in the running state, is suspending all running applications.

RESUMING

Server is resuming previously suspended applications.

SUSPENDED

All applications have been suspended. This state allows new applications to be distributed, but they cannot run.

FAILURE_SUSPECTED

MASTER suspects that the MS may have shut down abnormally because it cannot connect to the MS.

FAILED

MASTER has determined that the MS has shut down abnormally because it has not been connected for a specific period of time.

MASTER checks MS state by using System Clustering Framework (SCF).

SCF is a module that allows servers in a domain to check other servers' state and to send/receive messages to/from other servers. Since it uses a network, it can recognize communication delay caused by a network issue (such as a remote server’s load) as an error. If the issue is resolved, it recognizes the state as normal.

SCF uses multicast by default, but it can use virtual multicast if the environment does not support multicast or there is a specific request. Virtual multicast allows socket communication between servers in a domain.

The following are the three ways to check for the server state.

  • Using an MBean

    Server states can be monitored using J2EEDomain#getServerState (String serverName). Refer to JEUS JMX Guide for detailed information about MBeans.

  • Using the console tool (jeusadmin)

    Server statuses can be checked using the following serverinfo command in the console tool.

    [MASTER]domain1.adminServer>serverinfo
    Information about Domain (domain1)
    ================================================================================
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    | Server | Status |Node | PID | Clu |   Latest   |  Need  |   Listen  |Running |
    |        |        |Name |     |ster | Start Time |   to   |   Ports   |Engines |
    |        |        |     |     |     | / Shutdown |Restart |           |        |
    |        |        |     |     |     |    Time    |        |           |        |
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    | adminS | RUNNIN | nod | 902 | N/A | 2022-07-19 | false  | base-0.0. | jms,   |
    |erver   |G(00:42 |e1   |88   |     | (Tue) PM   |        |0.0:9736   |web, ejb|
    |(*)     |:15)    |     |     |     |12:55:20 KST|        | http-serv |        |
    |        |        |     |     |     |            |        |er-0.0.0.0 |        |
    |        |        |     |     |     |            |        |:8088      |        |
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    | server1| RUNNIN | N/A | 928 | clu | 2022-07-19 | false  | base-0.0. | jms,   |
    |        |G(00:00 |     |05   |ster1| (Tue) PM   |        |0.0:9836   |web, ejb|
    |        |:08)    |     |     |     |01:37:27 KST|        | http-serv |        |
    |        |        |     |     |     |            |        |er-0.0.0.0 |        |
    |        |        |     |     |     |            |        |:8188      |        |
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    | server2| SHUTDO | N/A | N/A | clu | 2022-07-19 | N/A    | N/A       | N/A    |
    |        |WN      |     |     |ster1| (Tue) PM   |        |           |        |
    |        |        |     |     |     |12:55:20 KST|        |           |        |
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    | server3| SHUTDO | nod | N/A | N/A | 2022-07-19 | N/A    | N/A       | N/A    |
    |        |WN      |e1   |     |     | (Tue) PM   |        |           |        |
    |        |        |     |     |     |12:55:20 KST|        |           |        |
    +--------+--------+-----+-----+-----+------------+--------+-----------+--------+
    ================================================================================
    
    ===============================================================================================

    For more information about the serverinfo command, refer to server-info in JEUS Reference Guide.