Creating, starting, and stopping servers
You can use the server script in the WebSphere® Liberty profile bin directory to create, start, stop, and check a server process. You can also run the serverManager shutdown command to stop a server, or isonline to determine whether a server is running.
About this task
The server management script in the <InstallDir>/runtime/wlp/bin directory contains the following useful actions:
- create: Creates a server.
- start: Starts the server as a background process.
- stop: Stops a catalog or connectivity server.
- status: Checks whether a specified server is running.
- dump: Dumps diagnostic information from the server into an archive.
- javadump: Dumps diagnostic information from the server JVM.
The server script uses the JAVA_HOME and JRE_HOME variables to find the java.exe file in your environment. Use server.env files at the installation and server levels to specify environment variables such as JAVA_HOME, WLP_USER_DIR, and WLP_OUTPUT_DIR.
A server requires a server.xml configuration file. This file describes the configuration of the server, either through direct assignment of values, or by including other configuration files. Bootstrap properties affect the configuration and initialization of the server. These properties can be specified through system properties or in a bootstrap.properties file in the server directory.
Enter the following commands to use the server script:
- server create server_name --template=template_name
- server start server_name
- server stop server_name
- server status server_name
- server dump server_name
- server javadump server_name
Where:
- The server_name is the name of an existing server, or the name of the server you want to create. If a server name is not specified, defaultServer is used.
- The template_name is the name of a server template.
Templates are provided in the <InstallDir>/runtime/wlp/templates/servers directory
for the following Insight Server types:
cisDev, cisContainer, cisCatalog, cisInbound, cisOutbound.
The single-server configuration (cisDev) is optimized for development with minimal configuration steps required to get the system up and running. In a cisDev server, both inbound and outbound connectivity are hosted, and HTTP inbound and outbound features are also enabled by default.
To stop and restart the servers in a multiple-server production environment, you must stop and shut down the servers in a specific order. See Maintaining operations in a production environment.
If you are working through instructions to configure the hosts for the different servers for the first time or you are making a backup, you might need to shut down the system, adjust something, and then restart the system. In this case, stop the servers in the following order from the <InstalliDir>/runtime/wlp/bin directory.
- Inbound servers: server stop server_name
- Runtime servers: serverManager shutdown [options]
- Outbound servers: server stop server_name
- Catalog servers: server stop server_name
The stop command is used on catalog and connectivity (cisInbound, cisOutbound) servers. Inbound servers are stopped first to stop the flow of events into the system. Runtime servers can be stopped after they process the outstanding events.
The shutdown command pauses and shutdowns server processes and components in the correct order, and ends pending processing and pauses components that are affected by the shutdown. For a runtime server, the command also communicates with the catalog server to check the status of WebSphere eXtreme Scale processes, then waits until these processes are finished before it shuts down the server. Outbound servers can then be stopped, followed by catalog servers.
If you intend to start a server immediately after you stop it, you must give the system time to balance all of the partitions. While the amount of time is not deterministic, around a minute is usually sufficient.
Before you shut down the runtime servers check that the server is no longer processing events. The CPU usage of the server Java™ process is the best way to determine processing is stopped. Run the serverManager isonline command to determine which Liberty servers are active. Use this command to identify servers where you can deploy or activate solutions. You must provide administrator authentication credentials to run the script. If Insight Monitor is enabled, the CPU and Event Rates pages can be used to determine when the servers are not active.
Start the servers again in the following order from the <InstalliDir>/runtime/wlp/bin directory:
- Catalog servers: server start server_name
- Runtime servers: server start server_name
- Outbound servers: server start server_name
- Inbound servers: server start server_name
Inbound servers are started last because after the first inbound server is up, events might begin flowing into the system.
Procedure
Results
By default, a server uses TCP/IP port 9080 for HTTP traffic, and port 9443 for HTTPS traffic. In some situations, the TCP/IP port is not released immediately when the server stops, and an error occurs when the server is restarted, for example: The port might already be in use.
Linux provides several administrative tools and utilities to help you manage your system:
- cat /proc/sys/net/ipv4/tcp_fin_timeout: Returns the contents of a TCP variable named tcp_fin_timeout.
- netstat -a | more: Lists all ports on your system.
To change the TCP timeout so that it persists across restarts, you can add the value to /etc/sysctl.conf. For example, set the timeout value to 10 seconds by running this command to modify the system control file:
sysctl -w net.ipv4.tcp_fin_timeout=10