Chapter 4. Performing cross-site operations with the REST API Data Grid Server provides a REST endpoint that exposes methods for performing cross-site operations. 4.1. Getting status of all backup locations Retrieve the status of all backup locations with GET requests. Data Grid responds with the status of each backup location in JSON format, as in the following example: { "NYC": { "status": "online" }, "LON": { "status": "mixed", "online": [ "NodeA" ], "offline": [ "NodeB" ] } } Table 4.1. Returned Status Value Description online All nodes in the local cluster have a cross-site view with the backup location. offline No nodes in the local cluster have a cross-site view with the backup location. mixed Some nodes in the local cluster have a cross-site view with the backup location, other nodes in the local cluster do not have a cross-site view. The response indicates status for each node. 4.2. Getting status of specific backup locations Retrieve the status of a backup location with GET requests. Data Grid responds with the status of each node in the site in JSON format, as in the following example: { "NodeA":"offline", "NodeB":"online" } Table 4.2. Returned Status Value Description online The node is online. offline The node is offline. failed Not possible to retrieve status. The remote cache could be shutting down or a network error occurred during the request. 4.3. Taking backup locations offline Take backup locations offline with POST requests and the ?action=take-offline parameter. 4.4. Bringing backup locations online Bring backup locations online with the ?action=bring-online parameter. 4.5. Pushing state to backup locations Push cache state to a backup location with the ?action=start-push-state parameter. 4.6. Canceling state transfer Cancel state transfer operations with the ?action=cancel-push-state parameter. 4.7. Getting state transfer status Retrieve status of state transfer operations with the ?action=push-state-status parameter. Data Grid responds with the status of state transfer for each backup location in JSON format, as in the following example: { "NYC":"CANCELED", "LON":"OK" } Table 4.3. Returned status Value Description SENDING State transfer to the backup location is in progress. OK State transfer completed successfully. ERROR An error occurred with state transfer. Check log files. CANCELLING State transfer cancellation is in progress. 4.8. Clearing state transfer status Clear state transfer status for sending sites with the ?action=clear-push-state-status parameter. 4.9. Modifying take offline conditions Sites go offline if certain conditions are met. Modify the take offline parameters to control when backup locations automatically go offline. Procedure Check configured take offline parameters with GET requests and the take-offline-config parameter. The Data Grid response includes after_failures and min_wait fields as follows: { "after_failures": 2, "min_wait": 1000 } Modify take offline parameters in the body of PUT requests. If the operation successfully completes, the service returns 204 (No Content) . 4.10. Canceling state transfer from receiving sites If the connection between two backup locations breaks, you can cancel state transfer on the site that is receiving the push. Cancel state transfer from a remote site and keep the current state of the local cache with the ?action=cancel-receive-state parameter. 4.11. Getting status of backup locations Retrieve the status of all backup locations from Cache Managers with GET requests. Data Grid responds with status in JSON format, as in the following example: { "SFO-3":{ "status":"online" }, "NYC-2":{ "status":"mixed", "online":[ "CACHE_1" ], "offline":[ "CACHE_2" ], "mixed": [ "CACHE_3" ] } } Table 4.4. Returned status Value Description online All nodes in the local cluster have a cross-site view with the backup location. offline No nodes in the local cluster have a cross-site view with the backup location. mixed Some nodes in the local cluster have a cross-site view with the backup location, other nodes in the local cluster do not have a cross-site view. The response indicates status for each node. Returns the status for a single backup location. 4.12. Taking backup locations offline Take backup locations offline with the ?action=take-offline parameter. 4.13. Bringing backup locations online Bring backup locations online with the ?action=bring-online parameter. 4.14. Retrieving the state transfer mode Check the state transfer mode with GET requests. 4.15. Setting the state transfer mode Configure the state transfer mode with the ?action=set parameter. 4.16. Starting state transfer Push state of all caches to remote sites with the ?action=start-push-state parameter. 4.17. Canceling state transfer Cancel ongoing state transfer operations with the ?action=cancel-push-state parameter.

Commands:
GET /rest/v2/caches/{cacheName}/x-site/backups/
{ "NYC": { "status": "online" }, "LON": { "status": "mixed", "online": [ "NodeA" ], "offline": [ "NodeB" ] } }
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}
NodeA: offline
NodeB: online
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
GET /rest/v2/caches/{cacheName}/x-site/backups?action=push-state-status
NYC: CANCELED
LON: OK
POST /rest/v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
after_failures: 2
min_wait: 1000
PUT /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-config
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
GET /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/
{ "SFO-3":{ "status":"online" }, "NYC-2":{ "status":"mixed", "online":[ "CACHE_1" ], "offline":[ "CACHE_2" ], "mixed": [ "CACHE_3" ] } }
GET /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/{site}
POST /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/{siteName}?action=bring-online
GET /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
POST /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/cache-managers/{cacheManagerName}/x-site/backups/{siteName}?action=cancel-push-state