Taking Configuration Snapshots in JBoss EAP

15 minutes
  • 4 Learning Objectives

About this Hands-on Lab

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
  1. Stop the current JBoss EAP server:

    sudo systemctl stop jboss-eap-rhel
  1. Move into the JBoss EAP home directory:

    cd /opt/jboss-eap
  2. Start a standalone server using the 20191121-201850161standalone.xml snapshot:

    sudo ./bin/standalone.sh --server-config=standalone_xml_history/snapshot/20191121-201850161standalone.xml
  3. Check that you can access the management console at PUBLICIP:9990.

  4. 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.

  1. Restart the JBoss service:

    sudo systemctl start jboss-eap-rhel
  2. Open the JBoss CLI:

    sudo ./bin/jboss-cli.sh
  3. Connect to the server:

    connect
  4. Take a snapshot of the current configuration:

    :take-snapshot
  5. Exit the CLI:

    exit
Replace the Standalone Configuration
  1. We know the 20191121-201850161standalone.xml configuration is the one we wish to use. Since we know our jboss-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
  1. Restart the service:

    sudo systemctl restart jboss-eap-rhel
  2. Confirm you can access the management console.

Delete the Old Snapshot
  1. Access the JBoss CLI:

    sudo ./bin/jboss-cli.sh
  1. Connect to the server:

    connect
  2. List the available snapshots:

    :list-snapshots
  3. Remove the backup snapshot of the failing configuration:

    :delete-snapshot(name=20191122-133032735standalone.xml)
  4. Exit the CLI:

    exit

Additional Resources

After a configuration change, no one can access the JBoss EAP Management Console. As such, you want to fall back to a working configuration.

To confirm the management console is accessible, run a standalone server using the existing snapshot —20191121-201850161standalone.xml.

Once you have confirmed you can access the management console, we want to fall back to that configuration. Replace the expected /opt/jboss-eap/standalone/configuration/standalone.xml file with content from the working snapshot. Be sure to take a snapshot of the current, failing configuration before making the switch though, just in case something fails.

Once the standalone configuration has been replaced, confirm it's working by accessing the management console. Remove the snapshot you just took of the failing configuration.

The management console can be accessed at PUBLICIP:9990 with the user admin and the password pinehead.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?