29.3. Taking a Site Offline
In Red Hat JBoss Data Grid's Cross-datacenter replication configuration, if backing up to one site fails a certain number of times during a time interval, that site can be marked as offline automatically. This feature removes the need for manual intervention by an administrator to mark the site as offline.
It is possible to configure JBoss Data Grid to take down a site automatically when specified conditions are met, or for an administrator to manually take down a site:
- Configure automatically taking a site offline:
- Declaratively in Remote Client-Server mode.
- Declaratively in Library mode.
- Using the programmatic method.
- Manually taking a site offline:
- Using JBoss Operations Network (JON).
- Using the JBoss Data Grid Command Line Interface (CLI).
29.3.1. Taking a Site Offline (Remote Client-Server Mode)
In Red Hat JBoss Data Grid's Remote Client-Server mode, the
take-offline
element is added to the backup
element to configure when a site is automatically taken offline.
Example 29.2. Taking a Site Offline in Remote Client-Server Mode
<backup> <take-offline after-failures="${NUMBER}" min-wait="${PERIOD}" /> </backup>
The
take-offline
element use the following parameters to configure when to take a site offline:
- The
after-failures
parameter specifies the number of times attempts to contact a site can fail before the site is taken offline. - The
min-wait
parameter specifies the number (in milliseconds) to wait to mark an unresponsive site as offline. The site is offline when themin-wait
period elapses after the first attempt, and the number of failed attempts specified in theafter-failures
parameter occur.
29.3.2. Taking a Site Offline (Library Mode)
In Red Hat JBoss Data Grid's Library mode, use the
backupFor
element after defining all back up sites within the backups
element:
Example 29.3. Taking a Site Offline in Library Mode
<backup> <takeOffline afterFailures="${NUM}" minTimeToWait="${PERIOD}"/> </backup>
Add the
takeOffline
element to the backup
element to configure automatically taking a site offline.
- The
afterFailures
parameter specifies the number of times attempts to contact a site can fail before the site is taken offline. The default value (0
) allows an infinite number of failures ifminTimeToWait
is less than0
. If theminTimeToWait
is not less than0
,afterFailures
behaves as if the value is negative. A negative value for this parameter indicates that the site is taken offline after the time specified byminTimeToWait
elapses. - The
minTimeToWait
parameter specifies the number (in milliseconds) to wait to mark an unresponsive site as offline. The site is taken offline after the number attempts specified in theafterFailures
parameter conclude and the time specified byminTimeToWait
after the first failure has elapsed. If this parameter is set to a value smaller than or equal to0
, this parameter is disregarded and the site is taken offline based solely on theafterFailures
parameter.
29.3.3. Taking a Site Offline (Programmatically)
To configure taking a Cross-datacenter replication site offline automatically in Red Hat JBoss Data Grid programmatically:
Example 29.4. Taking a Site Offline Programmatically
lon.sites().addBackup() .site("NYC") .backupFailurePolicy(BackupFailurePolicy.FAIL) .strategy(BackupConfiguration.BackupStrategy.SYNC) .takeOffline() .afterFailures(500) .minTimeToWait(10000);
29.3.4. Taking a Site Offline via JBoss Operations Network (JON)
A site can be taken offline in Red Hat JBoss Data Grid using the JBoss Operations Network operations. For a list of the metrics, see Section 22.6.2, “JBoss Operations Network Plugin Operations”
29.3.5. Taking a Site Offline via the CLI
Use Red Hat JBoss Data Grid's Command Line Interface (CLI) to manually take a site from a cross-datacenter replication configuration down if it is unresponsive using the
site
command.
The
site
command can be used to check the status of a site as follows:
[jmx://localhost:12000/MyCacheManager/namedCache]> site --status ${SITENAME}
The result of this command would either be
online
or offline
according to the current status of the named site.
The command can be used to bring a site online or offline by name as follows:
[jmx://localhost:12000/MyCacheManager/namedCache]> site --offline ${SITENAME}
[jmx://localhost:12000/MyCacheManager/namedCache]> site --online ${SITENAME}
If the command is successful, the output
ok
displays after the command.
For more information about the JBoss Data Grid CLI and its commands, see the Developer Guide's chapter on the JBoss Data Grid Command Line Interface (CLI)
29.3.6. Bring a Site Back Online
After a site is taken offline, currently the only way to bring the site back online is using the JMX console to invoke the
bringSiteOnline(siteName)
operation on the XSiteAdmin
MBean. For details about this MBean, see Section A.21, “XSiteAdmin”