When making changes to a JBoss EAP server configuration, it’s often worthwhile to ensure copies of these configurations exist, both to revert to a snapshot should a change fail or simply to save a successful configuration for use on other servers. To do this, we can work with JBoss EAP’s native snapshot feature to take, manage, and remove configuration snapshots.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Deploy a Standalone Server Based on the Provided Snapshot
Stop the current JBoss EAP server:
sudo systemctl stop jboss-eap-rhel
Move into the JBoss EAP home directory:
cd /opt/jboss-eap
Start a standalone server using the
20191121-201850161standalone.xml
snapshot:sudo ./bin/standalone.sh --server-config=standalone_xml_history/snapshot/20191121-201850161standalone.xml
Check that you can access the management console at
PUBLICIP:9990
.Shut down the server with CTRL+C.
- Take a Snapshot of the Current Deployment
Before replacing the configuration file, we want to take a snapshot of the current configuration located at
/opt/jboss-eap/standalone/configuration/standalone.xml
just in case something fails.Note: This is the configuration used by our service and the one used in the
/opt/jboss/bin/standalone.sh
script, unless we override it as we did in the previous task.Restart the JBoss service:
sudo systemctl start jboss-eap-rhel
Open the JBoss CLI:
sudo ./bin/jboss-cli.sh
Connect to the server:
connect
Take a snapshot of the current configuration:
:take-snapshot
Exit the CLI:
exit
- Replace the Standalone Configuration
We know the
20191121-201850161standalone.xml
configuration is the one we wish to use. Since we know ourjboss-eap-rhel
service relies on/opt/jboss-eap/standalone/configuration/standalone.xml
, we can just copy our snapshot there:sudo cp standalone/configuration/standalone_xml_history/snapshot/20191121-201850161standalone.xml standalone/configuration/standalone.xml
Restart the service:
sudo systemctl restart jboss-eap-rhel
Confirm you can access the management console.
- Delete the Old Snapshot
Access the JBoss CLI:
sudo ./bin/jboss-cli.sh
Connect to the server:
connect
List the available snapshots:
:list-snapshots
Remove the backup snapshot of the failing configuration:
:delete-snapshot(name=20191122-133032735standalone.xml)
Exit the CLI:
exit