31.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). Report a bug 31.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 31.2. Taking a Site Offline in Remote Client-Server Mode 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 the min-wait period elapses after the first attempt, and the number of failed attempts specified in the after-failures parameter occur. Report a bug 31.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 31.3. Taking a Site Offline in Library Mode 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 if minTimeToWait is less than 0 . If the minTimeToWait is not less than 0 , 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 by minTimeToWait 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 the afterFailures parameter conclude and the time specified by minTimeToWait after the first failure has elapsed. If this parameter is set to a value smaller than or equal to 0 , this parameter is disregarded and the site is taken offline based solely on the afterFailures parameter. Report a bug 31.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 31.4. Taking a Site Offline Programmatically Report a bug 31.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" Report a bug 31.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: 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: If the command is successful, the output ok displays after the command. As an alternate, the site can also be brought online using JMX (see Section 31.3.6, "Bring a Site Back Online" for details). 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) Report a bug 31.3.6. Bring a Site Back Online After a site is taken offline, the site can be brought back online either using the JMX console to invoke the bringSiteOnline( siteName ) operation on the XSiteAdmin MBean (See Section C.23, "XSiteAdmin" for details) or using the CLI (see Section 31.3.5, "Taking a Site Offline via the CLI" for details). Report a bug

Commands:
<backup> <take-offline after-failures="USD{NUMBER}" min-wait="USD{PERIOD}" /> </backup>
<backup> <takeOffline afterFailures="USD{NUM}" minTimeToWait="USD{PERIOD}"/> </backup>
lon.sites().addBackup() .site("NYC") .backupFailurePolicy(BackupFailurePolicy.FAIL) .strategy(BackupConfiguration.BackupStrategy.SYNC) .takeOffline() .afterFailures(500) .minTimeToWait(10000);
[jmx://localhost:12000/MyCacheManager/namedCache]> site --status USD{SITENAME}
[jmx://localhost:12000/MyCacheManager/namedCache]> site --offline USD{SITENAME}
[jmx://localhost:12000/MyCacheManager/namedCache]> site --online USD{SITENAME}