How Snapshoting works with EAP 6

This simple little guide shows more or less how a snapshot works with EAP 6. I’ll show what happens to a deployable when a snapshot is taken between another version of the app without a name change and the newer version is deployed on the same server.

I am using a standard configuration file from JBoss EAP 6.1.1, though the same will hold true for any configuration file.

Use Case

  1. Deploy war, take snapshot, deploy updated archive with different name and same runtime name, disable initial war, reload,
Deploy war archive
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy --name=snap1 snapshot-test.war --runtime-name=snapshot-test.war"
verify deployment
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy -l"
NAME  RUNTIME-NAME      ENABLED STATUS
snap1 snapshot-test.war false   STOPPED
Take snapshot
$ JBOSS_HOME/bin/jboss-cli.sh -c --command=":take-snapshot"
{
    "outcome" => "success",
    "result" => "/opt/app/jboss/jboss-eap-6.1/standalone/configuration/standalone_xml_history/snapshot/20141104-12283814720141104-113544608snapshot-uc-1.xml"
}
Disable War

The archive needs to be disabled or else the container will simply use the first instance of the war, since both of the deployables will have the same name.

$ JBOSS_HOME/bin/jboss-cli.sh -c --command="/deployment=snap1:undeploy()"
Deploy second archive
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy --name=snap2 tweaked-war/snapshot-test.war --runtime-name=snapshot-test.war"
verify deployment
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy -l"
NAME  RUNTIME-NAME      ENABLED STATUS
snap1 snapshot-test.war false   STOPPED
snap2 snapshot-test.war true    no metrics available
You will may have to reload the server for the container to recongnize the newer reference to the archive
Take snapshot
$ JBOSS_HOME/bin/jboss-cli.sh -c --command=":take-snapshot"
{
    "outcome" => "success",
    "result" => "/opt/app/jboss/jboss-eap-6.1/standalone/configuration/standalone_xml_history/snapshot/20141104-12315947120141104-113544608snapshot-uc-1.xml"
}
Stop current instance of EAP
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="shutdown"
Start EAP with first snapshot
$ JBOSS_HOME/bin/standalone.sh -c standalone_xml_history/snapshot/20141104-12283814720141104-113544608snapshot-uc-1.xml -b 0.0.0.0 &
verify deployment
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy -l"
NAME                 RUNTIME-NAME         ENABLED STATUS
snap1                snapshot-test.war    true    OK
Stop current instance of EAP
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="shutdown"
Start EAP with second snapshot
$ JBOSS_HOME/bin/standalone.sh -c standalone_xml_history/snapshot/20141104-12315947120141104-113544608snapshot-uc-1.xml -b 0.0.0.0 &
verify deployment
$ JBOSS_HOME/bin/jboss-cli.sh -c --command="deploy -l"
NAME                 RUNTIME-NAME         ENABLED STATUS
snap1                snapshot-test.war    false   STOPPED
snap2                snapshot-test.war    true    no metrics available
Advertisements

Author: jasonmarley

I have been with Red Hat since 2010 and love it! My day to day is consulting on RHEL/JBoss/OpenShift, but I work on open source projects in my free time. The best part about my job are my awesome colleagues and our community.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s