Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Starting and Stopping JBoss EAP
2.1. Starting JBoss EAP Copiar o linkLink copiado para a área de transferência!
JBoss EAP is supported on Red Hat Enterprise Linux, Windows Server, and Oracle Solaris, and runs in either a standalone server or managed domain operating mode. The specific command to start JBoss EAP depends on the underlying platform and the desired operating mode.
Servers are initially started in a suspended state and will not accept any requests until all required services have started, at which time the servers are placed into a normal running state and can start accepting requests.
Start JBoss EAP as a Standalone Server
EAP_HOME/bin/standalone.sh
$ EAP_HOME/bin/standalone.sh
For Windows Server, use the EAP_HOME\bin\standalone.bat script.
This startup script uses the EAP_HOME/bin/standalone.conf file, or standalone.conf.bat for Windows Server, to set some default preferences, such as JVM options. You can customize the settings in this file.
JBoss EAP uses the standalone.xml configuration file by default, but can be started using a different one. For details on the available standalone configuration files and how to use them, see the Standalone Server Configuration Files section.
For a complete listing of all available startup script arguments and their purposes, use the --help argument or see the Server Runtime Arguments section.
Start JBoss EAP in a Managed Domain
The domain controller must be started before the servers in any of the server groups in the domain. Use this script to first start the domain controller, and then for each associated host controller.
EAP_HOME/bin/domain.sh
$ EAP_HOME/bin/domain.sh
For Windows Server, use the EAP_HOME\bin\domain.bat script.
This startup script uses the EAP_HOME/bin/domain.conf file, or domain.conf.bat for Windows Server, to set some default preferences, such as JVM options. You can customize the settings in this file.
JBoss EAP uses the host.xml host configuration file by default, but can be started using a different one. For details on the available managed domain configuration files and how to use them, see the Managed Domain Configuration Files section.
When setting up a managed domain, additional arguments will need to be passed into the startup script. For a complete listing of all available startup script arguments and their purposes, use the --help argument or see the Server Runtime Arguments section.
2.2. Stopping JBoss EAP Copiar o linkLink copiado para a área de transferência!
The way that you stop JBoss EAP depends on how it was started.
Stop an Interactive Instance of JBoss EAP
Press Ctrl+C in the terminal where JBoss EAP was started.
Stop a Background Instance of JBoss EAP
Use the management CLI to connect to the running instance and shut down the server.
Launch the management CLI.
EAP_HOME/bin/jboss-cli.sh --connect
$ EAP_HOME/bin/jboss-cli.sh --connectCopy to Clipboard Copied! Toggle word wrap Toggle overflow Issue the
shutdowncommand.shutdown
shutdownCopy to Clipboard Copied! Toggle word wrap Toggle overflow
When running in a managed domain, you must specify the host name to shut down by using the --host argument with the shutdown command.
2.3. Running JBoss EAP in Admin-only Mode Copiar o linkLink copiado para a área de transferência!
JBoss EAP has the ability to be started in admin-only mode. This enables JBoss EAP to run and accept management requests but not start other runtime services or accept end user requests. Admin-only mode is available in both standalone servers as well as managed domains.
Running a Standalone Server in Admin-only Mode
Start the Server in Admin-only Mode
To start a JBoss EAP instance in admin-only mode, use the --start-mode=admin-only runtime argument when starting the JBoss EAP instance.
EAP_HOME/bin/standalone.sh --start-mode=admin-only
$ EAP_HOME/bin/standalone.sh --start-mode=admin-only
Check If the Server is Running in Admin-only Mode
Use the following command to check the running mode of the server. The result will be ADMIN_ONLY if the server is running in admin-only mode.
:read-attribute(name=running-mode)
{
"outcome" => "success",
"result" => "ADMIN_ONLY"
}
:read-attribute(name=running-mode)
{
"outcome" => "success",
"result" => "ADMIN_ONLY"
}
Additionally, you can check the initial running mode in which JBoss EAP was launched by using the following command.
/core-service=server-environment:read-attribute(name=initial-running-mode)
/core-service=server-environment:read-attribute(name=initial-running-mode)
Reload in a Different Mode from the Management CLI
In addition to stopping and starting a JBoss EAP instance with a different runtime switch, the management CLI may also be used to reload it in a different mode.
To reload the server in admin-only mode:
reload --start-mode=admin-only
reload --start-mode=admin-only
To reload the server in normal mode:
reload --start-mode=normal
reload --start-mode=normal
Note that if the server was started in admin-only mode and no --start-mode argument is specified to the reload command, the server will be started in normal mode.
Running a Managed Domain in Admin-only Mode
In a managed domain, if a domain controller is started in admin-only mode, it will not accept incoming connections from slave host controllers.
Start a Host Controller in Admin-only Mode
Pass in the --admin-only runtime argument to start a host controller in admin-only mode.
EAP_HOME/bin/domain.sh --admin-only
$ EAP_HOME/bin/domain.sh --admin-only
Check If a Host Controller is Running in Admin-only Mode
Use the following command to check the running mode of a host controller. The result will be ADMIN_ONLY if the host controller is running in admin-only mode.
/host=HOST_NAME:read-attribute(name=running-mode)
{
"outcome" => "success",
"result" => "ADMIN_ONLY"
}
/host=HOST_NAME:read-attribute(name=running-mode)
{
"outcome" => "success",
"result" => "ADMIN_ONLY"
}
Reload in a Different Mode from the Management CLI
In addition to stopping and starting a host controller with a different runtime switch, the management CLI may also be used to reload it in a different mode.
To reload the host controller in admin-only mode:
reload --host=HOST_NAME --admin-only=true
reload --host=HOST_NAME --admin-only=true
To reload a host controller in normal mode:
reload --host=HOST_NAME --admin-only=false
reload --host=HOST_NAME --admin-only=false
Note that if the host controller was started in admin-only mode and no --admin-only argument is specified to the reload command, the host controller will be started in normal mode.
2.4. Suspend and Shut Down JBoss EAP Gracefully Copiar o linkLink copiado para a área de transferência!
JBoss EAP can be suspended or shut down gracefully. This allows active requests to complete normally, without accepting any new requests. A timeout value specifies how long that the suspend or shut down operation will wait for active requests to complete. While the server is suspended, management requests are still processed.
Graceful shutdown is coordinated at a server-wide level, mostly focused on the entry points at which a request enters the server. The following subsystems support graceful shutdown:
- Undertow
-
The
undertowsubsystem will wait for all requests to finish. - mod_cluster
-
The
modclustersubsystem will notify the load balancer that the server is suspending in thePRE_SUSPENDphase. - EJB
-
The
ejb3subsystem will wait for all remote EJB requests and MDB message deliveries to finish. Delivery to MDBs is stopped in thePRE_SUSPENDphase. EJB timers are suspended, and missed timers will be activated when the server is resumed. - Transactions
Once suspended, the server will not accept new requests, but in-flight transactions and requests are allowed to continue until they complete or until the timeout period expires. This also applies for web service requests associated with an XTS transaction.
NoteBy default, transaction graceful shutdown is disabled for the
ejbsubsystem. You must enable transaction graceful shutdown if you want the server to wait for EJB-related transactions to complete before suspending. For example:/subsystem=ejb3:write-attribute(name=enable-graceful-txn-shutdown,value=true)
/subsystem=ejb3:write-attribute(name=enable-graceful-txn-shutdown,value=true)Copy to Clipboard Copied! Toggle word wrap Toggle overflow - EE Concurrency
The server will wait for all active jobs to finish. All queued jobs will be skipped. Currently, since EE Concurrency does not have persistence, those queued jobs that were skipped will be lost.
While the server is in a suspended state, scheduled tasks will continue to execute at their scheduled times but will throw a
java.lang.IllegalStateException. Once the server is resumed, scheduled tasks will continue to execute normally, and in most cases tasks will not need to be rescheduled.- Batch
- The server will stop all running jobs within the timeout period and defer all scheduled jobs.
Graceful shutdown currently will not reject new inbound JMS messages. EE batch jobs and EE concurrency tasks scheduled by in-flight activity are currently allowed to proceed; however, EE concurrency tasks submitted that pass the timeout window currently error when executed.
Requests are tracked by the request-controller subsystem. Without this subsystem, suspend and resume capabilities are limited and the server will not wait for requests to complete before suspending or shutting down; however, if you do not need this capability, the request-controller subsystem can be removed for a small performance improvement.
2.4.1. Suspend Servers Copiar o linkLink copiado para a área de transferência!
JBoss EAP 7 introduced a suspend mode, which suspends server operations gracefully. This allows all active requests to complete normally, but will not accept any new requests. Once the server has been suspended, it can be shut down, returned back to a running state, or left in a suspended state to perform maintenance.
The management interfaces are not impacted by suspending the server.
The server can be suspended and resumed using the management console or the management CLI.
Check the Server Suspend State
The server suspend state can be viewed using the following management CLI commands. The resulting value will be one of RUNNING, PRE_SUSPEND, SUSPENDING, or SUSPENDED.
Check the suspend state for a standalone server.
:read-attribute(name=suspend-state)
:read-attribute(name=suspend-state)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check the suspend state for a server in a managed domain.
/host=master/server=server-one:read-attribute(name=suspend-state)
/host=master/server=server-one:read-attribute(name=suspend-state)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Suspend
Use the following management CLI commands to suspend the server, specifying the timeout value, in seconds, for the server to wait for active requests to complete. The default is 0, which will suspend immediately. A value of -1 will cause the server to wait indefinitely for all active requests to complete.
Each example waits up to 60 seconds for requests to complete before suspending.
Suspend a standalone server.
:suspend(suspend-timeout=60)
:suspend(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Suspend all servers in a managed domain.
:suspend-servers(suspend-timeout=60)
:suspend-servers(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Suspend a single server in a managed domain.
/host=master/server-config=server-one:suspend(suspend-timeout=60)
/host=master/server-config=server-one:suspend(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Suspend all servers in a server group.
/server-group=main-server-group:suspend-servers(suspend-timeout=60)
/server-group=main-server-group:suspend-servers(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Suspend all servers at the host level.
/host=master:suspend-servers(suspend-timeout=60)
/host=master:suspend-servers(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Resume
The resume command returns the server to a normal running state to accept new requests. You can initiate the command at the host, server, server group, or domain level. For example:
:resume
:resume
Start a Server in a Suspended State
You can start a server in a suspended state so that no requests are accepted by the server until it is resumed.
To start a standalone server in a suspended state, use the
--start-mode=suspendruntime argument when starting the JBoss EAP instance.EAP_HOME/bin/standalone.sh --start-mode=suspend
$ EAP_HOME/bin/standalone.sh --start-mode=suspendCopy to Clipboard Copied! Toggle word wrap Toggle overflow To start a managed domain server in a suspended state, pass the
start-mode=suspendargument to thestartoperation in the management CLI command./host=HOST_NAME/server-config=SERVER_NAME:start(start-mode=suspend)
/host=HOST_NAME/server-config=SERVER_NAME:start(start-mode=suspend)Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can also pass the
start-modeargument to thereloadandrestartoperations for a server.To start all servers in a managed domain server group in a suspended state, pass the
start-mode=suspendargument to thestart-serversoperation in the management CLI command./server-group=SERVER_GROUP_NAME:start-servers(start-mode=suspend)
/server-group=SERVER_GROUP_NAME:start-servers(start-mode=suspend)Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can also pass the
start-modeargument to thereload-serversandrestart-serversoperations for a server group.
2.4.2. Shut Down Servers Gracefully Using the Management CLI Copiar o linkLink copiado para a área de transferência!
A server will be shut down gracefully if an appropriate timeout value is specified when stopping the server. Once the command is issued, the server will be suspended and will wait up to the specified timeout for all requests to finish before shutting down.
Use the following management CLI commands to shut down the server gracefully. Specify the timeout value, in seconds, for the server to wait for active requests to complete. The default is 0, which will shut down the server immediately. A value of -1 will cause the server to wait indefinitely for all active requests to complete before shutting down.
Each example waits up to 60 seconds for requests to complete before shutting down.
Shut down a standalone server gracefully.
shutdown --suspend-timeout=60
shutdown --suspend-timeout=60Copy to Clipboard Copied! Toggle word wrap Toggle overflow Stop all servers in a managed domain gracefully.
:stop-servers(suspend-timeout=60)
:stop-servers(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Stop a single server in a managed domain gracefully.
/host=master/server-config=server-one:stop(suspend-timeout=60)
/host=master/server-config=server-one:stop(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Stop all servers in a server group gracefully.
/server-group=main-server-group:stop-servers(suspend-timeout=60)
/server-group=main-server-group:stop-servers(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow Shutdown the host controller and all the servers it manages.
/host=master:shutdown(suspend-timeout=60)
/host=master:shutdown(suspend-timeout=60)Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe
suspend-timeoutattribute is only applied to the servers managed by the host controller, not the host controller itself.
2.4.3. Shut Down Servers Gracefully Using an OS Signal Copiar o linkLink copiado para a área de transferência!
A server can be shut down gracefully by sending an OS TERM signal, such as with kill -15 PID. By default, this value is identical to the management CLI’s shutdown --suspend-timeout=0 command, resulting in immediate termination of any currently processing requests. The timeout can be configured by org.wildfly.sigterm.suspend.timeout system property, indicating the maximum number of seconds to wait for requests to complete before the server shuts down. A value of -1 indicates that the server will wait indefinitely.
In a managed domain OS signals should not be used to shut down servers. Instead, servers should be shut down using the management CLI and through the managing Host Controller.
Graceful shutdown using an OS signal will not work if the JVM is configured to disable signal handling, such as if the -Xrs java argument has been passed to the JVM options, or if the signal sent is not one the process can respond to, such as if a KILL signal is sent.
2.5. Starting and Stopping JBoss EAP (RPM Installation) Copiar o linkLink copiado para a área de transferência!
Starting and stopping JBoss EAP is different for an RPM installation compared to a ZIP or installer installation.
2.5.1. Starting JBoss EAP (RPM Installation) Copiar o linkLink copiado para a área de transferência!
The command for starting an RPM installation of JBoss EAP depends on which operating mode you want to start, a standalone server or a managed domain, and which Red Hat Enterprise Linux version you are running.
Start JBoss EAP as a Standalone Server (RPM Installation)
For Red Hat Enterprise Linux 6:
service eap7-standalone start
$ service eap7-standalone startCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7 and later:
systemctl start eap7-standalone.service
$ systemctl start eap7-standalone.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
This will start JBoss EAP using the standalone.xml configuration file by default. You can start JBoss EAP with a different standalone server configuration file by setting a property in the RPM service configuration file. For more information, see the Configure RPM Service Properties section below.
Start JBoss EAP in a Managed Domain (RPM Installation)
For Red Hat Enterprise Linux 6:
service eap7-domain start
$ service eap7-domain startCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7 and later:
systemctl start eap7-domain.service
$ systemctl start eap7-domain.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
This will start JBoss EAP using the host.xml configuration file by default. You can start JBoss EAP with a different managed domain configuration file by setting a property in the RPM service configuration file. For more information, see the Configure RPM Service Properties section below.
Configure RPM Service Properties
This section shows you how to configure the RPM service properties and other startup options for your JBoss EAP installation. Note that it is recommended to back up your configuration files before making modifications.
For a listing of all available startup options for an RPM installation, see the RPM Service Configuration Properties section.
For Red Hat Enterprise Linux 7 and later, RPM service configuration files are loaded using systemd, so variable expressions are not expanded.
Specify the server configuration file.
When starting a standalone server, the
standalone.xmlfile is used by default. When running in a managed domain, thehost.xmlfile is used by default. You can start JBoss EAP with a different configuration file by setting theWILDFLY_SERVER_CONFIGproperty in the appropriate RPM configuration file, for example,eap7-standalone.conf.WILDFLY_SERVER_CONFIG=standalone-full.xml
WILDFLY_SERVER_CONFIG=standalone-full.xmlCopy to Clipboard Copied! Toggle word wrap Toggle overflow Bind to a specific IP address.
By default, a JBoss EAP RPM installation binds to
0.0.0.0. You can bind JBoss EAP to a specific IP address by setting theWILDFLY_BINDproperty in the appropriate RPM configuration file, for example,eap7-standalone.conf.WILDFLY_BIND=192.168.0.1
WILDFLY_BIND=192.168.0.1Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf you want to bind the management interfaces to a specific IP address, this can be configured in the JBoss EAP startup configuration file as shown in the next example.
Set JVM options or Java properties.
You can specify JVM options or Java properties to pass into the JBoss EAP startup script by editing the startup configuration file. This file is
EAP_HOME/bin/standalone.conffor a standalone server orEAP_HOME/bin/domain.conffor a managed domain. The below example configures the heap size and binds the JBoss EAP management interfaces to an IP address.JAVA_OPTS="$JAVA_OPTS -Xms2048m -Xmx2048m" JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.management=192.168.0.1"
JAVA_OPTS="$JAVA_OPTS -Xms2048m -Xmx2048m" JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.management=192.168.0.1"Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteIf required, the JBoss EAP bind address must be configured using the
WILDFLY_BINDproperty and not using thejboss.bind.addressstandard property here.
If a property has the same name in both the RPM service configuration file, such as /etc/sysconfig/eap7-standalone, and in the JBoss EAP startup configuration file, such as EAP_HOME/bin/standalone.conf, the value that takes precedence is the one in the JBoss EAP startup configuration file. One such property is JAVA_HOME.
2.5.2. Stopping JBoss EAP (RPM Installation) Copiar o linkLink copiado para a área de transferência!
The command for stopping an RPM installation of JBoss EAP depends on which operating mode that was started, a standalone server or a managed domain, and which Red Hat Enterprise Linux version you are running.
Stop JBoss EAP as a Standalone Server (RPM Installation)
For Red Hat Enterprise Linux 6:
service eap7-standalone stop
$ service eap7-standalone stopCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7 and later:
systemctl stop eap7-standalone.service
$ systemctl stop eap7-standalone.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Stop JBoss EAP in a Managed Domain (RPM Installation)
For Red Hat Enterprise Linux 6:
service eap7-domain stop
$ service eap7-domain stopCopy to Clipboard Copied! Toggle word wrap Toggle overflow For Red Hat Enterprise Linux 7 and later:
systemctl stop eap7-domain.service
$ systemctl stop eap7-domain.serviceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
For a listing of all available startup options for an RPM installation, see the RPM Service Configuration Files section.
2.6. PowerShell Scripts (Windows Server) Copiar o linkLink copiado para a área de transferência!
The collection of PowerShell scripts is provided as Technology Preview only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features.
JBoss EAP includes PowerShell script equivalents for most of the JBoss EAP management scripts. This includes a PowerShell script to start JBoss EAP on Microsoft Windows Server.
The JBoss EAP PowerShell scripts are designed to work with PowerShell version 2 and newer running on tested versions of Windows Server.
The JBoss EAP PowerShell scripts are located in EAP_HOME\bin, and are used in mostly the same way as the JBoss EAP batch scripts.
For example, to start a standalone JBoss EAP server with the standalone-full.xml configuration file, use the following PowerShell command:
.\standalone.ps1 "-c=standalone-full.xml"
.\standalone.ps1 "-c=standalone-full.xml"
Arguments of the JBoss EAP PowerShell scripts must be in quotes.