WildFly CLI - Taking and Restoring Configuration Snapshots: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(8 intermediate revisions by the same user not shown)
Line 17: Line 17:
=Take a Configuration Snapshot=
=Take a Configuration Snapshot=


Before applying a configuration change - or a set of configuration changes - that could destabilize the application server instance, take a configuration snapshot as described below.
Before applying a configuration change (or a set of configuration changes) that could destabilize the application server instance, take a configuration snapshot as described below.


Connect to the application server with the CLI. More details on how to connect to the application server instance are available here: [[WildFly CLI Connect to a Controller|Connect to a Controller]].
Connect to the application server with the CLI. More details on how to connect to the application server instance are available here: [[WildFly CLI Connect to a Controller|Connect to a Controller]].
Line 30: Line 30:
     "result" => "./configuration/standalone_xml_history/snapshot/20160331-205313510standalone.xml"
     "result" => "./configuration/standalone_xml_history/snapshot/20160331-205313510standalone.xml"
}
}
</pre>
Record the name of the configuration snapshot (in this case <tt>20160331-205313510standalone.xml</tt>). This information will be needed in case we need to rollback.
=Rollback to a Specific Known Good State=
In order to rollback to a specific configuration, you will need the name of the configuration snapshot (in this case <tt>20160331-205313510standalone.xml</tt>).
Shutdown the application server instance, then restore the configuration file based on the backup:
<pre>
cp $JBOSS_HOME/standalone/configuration/standalone_xml_history/snapshot/<snapshot-name> cp $JBOSS_HOME/standalone/configuration/standalone.xml
</pre>
Example:
<pre>
cp $JBOSS_HOME/standalone/configuration/standalone_xml_history/snapshot//20160331-205313510standalone.xmlcp $JBOSS_HOME/standalone/configuration/standalone.xml
</pre>
The instance can then be shut down and restarted as usual.
Note that you can start the server based on the backup snapshot directly, as shown below:
<pre>
$JBOSS_HOME/bin/standalone.sh --server-config=standalone_xml_history/snapshot/<snapshot-name>
</pre>
Example:
<pre>
$JBOSS_HOME/bin/standalone.sh --server-config=standalone_xml_history/snapshot/20160331-205313510standalone.xml
</pre>
</pre>

Latest revision as of 04:13, 1 April 2016

Internal

Relevance

EAP 6.4

Overview

This article describes the procedure of taking a standalone instance configuration snapshot, usually performed before a significant CLI-based reconfiguration of the application server and restoring the initial configuration in case of re-configuration failure. This mechanism relies on the fact that the application server maintains a history of its past configurations, and it is capable of taking configuration snapshots. More details about this mechanism are available here:

WildFly Configuration History

Take a Configuration Snapshot

Before applying a configuration change (or a set of configuration changes) that could destabilize the application server instance, take a configuration snapshot as described below.

Connect to the application server with the CLI. More details on how to connect to the application server instance are available here: Connect to a Controller.

Take a configuration snapshot as follows:

[standalone@localhost:9999 /] cd /
[standalone@localhost:9999 /] :take-snapshot
{
    "outcome" => "success",
    "result" => "./configuration/standalone_xml_history/snapshot/20160331-205313510standalone.xml"
}

Record the name of the configuration snapshot (in this case 20160331-205313510standalone.xml). This information will be needed in case we need to rollback.

Rollback to a Specific Known Good State

In order to rollback to a specific configuration, you will need the name of the configuration snapshot (in this case 20160331-205313510standalone.xml).

Shutdown the application server instance, then restore the configuration file based on the backup:

cp $JBOSS_HOME/standalone/configuration/standalone_xml_history/snapshot/<snapshot-name> cp $JBOSS_HOME/standalone/configuration/standalone.xml

Example:

cp $JBOSS_HOME/standalone/configuration/standalone_xml_history/snapshot//20160331-205313510standalone.xmlcp $JBOSS_HOME/standalone/configuration/standalone.xml

The instance can then be shut down and restarted as usual.

Note that you can start the server based on the backup snapshot directly, as shown below:

$JBOSS_HOME/bin/standalone.sh --server-config=standalone_xml_history/snapshot/<snapshot-name>

Example:

$JBOSS_HOME/bin/standalone.sh --server-config=standalone_xml_history/snapshot/20160331-205313510standalone.xml