Administer Liberty from the command line
We can use the server command and ws-server.jar executable JAR file to create a server, to start, or stop a server, to check whether it is running, or debug a server.
The latest documentation for Liberty server commands is available on the Open Liberty website.
To with control the server process we use:
- cd $LIBERTY/wlp/bin
server <action> [server] [options]
Auto-scalable warning: The administrative console allows a start and a stop of a Liberty server that is a cluster member of an auto-scalable cluster, but only when the server is in maintenance mode. Starting or stopping a Liberty server from the command line when the Liberty server is a cluster member of an auto-scalable cluster can lead to unpredictable results.
This script supports the following actions:
- IBM_HEAPDUMPDIR
- IBM_COREDIR
- IBM_JAVACOREDIR
create | Create a new server. |
debug | Run the named server in the console foreground after a debugger connects to the debug port. The default port is 7777. We can use the WLP_DEBUG_ADDRESS variable to specify an alternative port. |
dump | Create a snapshot of a server and save the result into an archive file |
javadump | Create a snapshot of the server JVM and save the result into files. Each memory dump type creates a file, but not all memory dump types are supported by all virtual machines. The default directory for memory dump files is ${server.output.dir}. To set a different default directory, we must use an IBM JVM and set the following environment variables:
|
list | List the defined Liberty application servers. |
package | Packages a server. |
pause | Pause all components that can be paused on the server. To pause specific components, use the --target option. |
resume | Resume all components that can be paused on the server. To resume specific components, use the --target option. |
run | Launch the server in the foreground. |
start | Start the server as a background process. |
stop | Stop a running server. |
status | Check to see whether a specified server is running. |
version | Display the version information of current server and Java runtime environment. |
help | Get command-line script help, including details of more options. |
Note: If a server is not specified on the command line, the action is performed against the default server instance, defaultServer, if it exists. We can also carry out similar actions using the executable JAR file ws-server.jar that is in the ${wlp.install.dir}/bin/tools directory.
Example
Run the server script:- server create server_name
server package server_name
server run server_name
server help server_name
To run the executable JAR file ws-server.jar without using the server script:
-
java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar server_name --create
java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar server_name
java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar --help
The --help option provides information about more command-line parameters for the executable JAR file ws-server.jar, such as --stop, --version, --clean, --include.
- Server command options
- Start and stop a server from the command line
- Liberty: application client commands
- configUtility command
- Generate data definition language
- Generate a Liberty server dump from the command line
- Package a Liberty server from the command line
- Use Ant to automate tasks for Liberty
- Configure Maven to automate tasks for Liberty
- Use an OSGi console
- Generate Liberty configurations schema from the command line
Parent topic: Administer Liberty manually
Related information