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 Copy linkLink copied to clipboard!
Retrieve the status of all backup locations with GET requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/
GET /rest/v2/caches/{cacheName}/x-site/backups/
Data Grid responds with the status of each backup location in JSON format, as in the following example:
| Value | Description |
|---|---|
|
|
All nodes in the local cluster have the backup location with |
|
|
All nodes in the local cluster have the backup location with |
|
|
Some nodes in the local cluster have the backup location with |
4.2. Getting status of specific backup locations Copy linkLink copied to clipboard!
Retrieve the status of a backup location with GET requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}
GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}
Data Grid responds with the status of each node in JSON format, as in the following example:
{
"NodeA":"offline",
"NodeB":"online"
}
{
"NodeA":"offline",
"NodeB":"online"
}
| Value | Description |
|---|---|
|
|
The node has |
|
|
The node has |
|
| 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 Copy linkLink copied to clipboard!
Take backup locations offline with POST requests and the ?action=take-offline parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=take-offline
4.4. Bringing backup locations online Copy linkLink copied to clipboard!
Bring backup locations online with the ?action=bring-online parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=bring-online
4.5. Pushing state to backup locations Copy linkLink copied to clipboard!
Push cache state to a backup location with the ?action=start-push-state parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=start-push-state
4.6. Canceling state transfer Copy linkLink copied to clipboard!
Cancel state transfer operations with the ?action=cancel-push-state parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-push-state
4.7. Getting state transfer status Copy linkLink copied to clipboard!
Retrieve status of state transfer operations with the ?action=push-state-status parameter.
GET /rest/v2/caches/{cacheName}/x-site/backups?action=push-state-status
GET /rest/v2/caches/{cacheName}/x-site/backups?action=push-state-status
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"
}
{
"NYC":"CANCELED",
"LON":"OK"
}
| Value | Description |
|---|---|
|
| The state transfer to the backup location is in progress. |
|
| The state transfer completed successfully. |
|
| An error occurred with state transfer. Check the log files. |
|
| The state transfer cancellation is in progress. |
4.8. Clearing state transfer status Copy linkLink copied to clipboard!
Clear the state transfer status in the sending cluster with the ?action=clear-push-state-status parameter. It is recommended to clear it before starting the push for a new state transfer.
POST /rest/v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
POST /rest/v2/caches/{cacheName}/x-site/local?action=clear-push-state-status
4.9. Modifying take offline conditions Copy linkLink copied to clipboard!
The backup location go offline when certain conditions are met. Modify the take offline parameters to control when backup locations automatically go offline.
Procedure
Check configured take offline parameters with
GETrequests and thetake-offline-configparameter.GET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-configGET /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow The Data Grid response includes
after_failuresandmin_waitfields as follows:{ "after_failures": 2, "min_wait": 1000 }{ "after_failures": 2, "min_wait": 1000 }Copy to Clipboard Copied! Toggle word wrap Toggle overflow Modify the take offline parameters in the body of
PUTrequests.PUT /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-configPUT /rest/v2/caches/{cacheName}/x-site/backups/{siteName}/take-offline-configCopy to Clipboard Copied! Toggle word wrap Toggle overflow
If the operation successfully completes, the service returns 204 (No Content).
4.10. Canceling state transfer from receiving sites Copy linkLink copied to clipboard!
If the connection between two backup locations breaks, you can cancel state transfer on the backup location that is receiving the push.
Cancel state transfer from another location and keep the current state of the local cache with the ?action=cancel-receive-state parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
POST /rest/v2/caches/{cacheName}/x-site/backups/{siteName}?action=cancel-receive-state
4.11. Retrieving the state transfer mode Copy linkLink copied to clipboard!
Check the state transfer mode with GET requests.
GET /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode
GET /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode
4.12. Setting the state transfer mode Copy linkLink copied to clipboard!
Configure the state transfer mode with the ?action=set parameter.
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
POST /rest/v2/caches/{cacheName}/x-site/backups/{site}/state-transfer-mode?action=set&mode={mode}
4.13. Getting status of backup locations Copy linkLink copied to clipboard!
Retrieve the status of all backup locations with GET requests.
GET /rest/v2/container/x-site/backups/
GET /rest/v2/container/x-site/backups/
Data Grid responds with status in JSON format, as in the following example:
| Value | Description |
|---|---|
|
|
All caches in the local cluster have the backup location with |
|
|
All caches in the local cluster have the backup location with |
|
|
Some caches in the local cluster have the backup location with |
GET /rest/v2/container/x-site/backups/{site}
GET /rest/v2/container/x-site/backups/{site}
Returns the status for a single backup location.
4.14. Taking backup locations offline Copy linkLink copied to clipboard!
Take backup locations offline with the ?action=take-offline parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=take-offline
POST /rest/v2/container/x-site/backups/{siteName}?action=take-offline
4.15. Bringing backup locations online Copy linkLink copied to clipboard!
Bring backup locations online with the ?action=bring-online parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=bring-online
POST /rest/v2/container/x-site/backups/{siteName}?action=bring-online
4.16. Starting state transfer Copy linkLink copied to clipboard!
Push state of all caches to remote sites with the ?action=start-push-state parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=start-push-state
POST /rest/v2/container/x-site/backups/{siteName}?action=start-push-state
4.17. Canceling state transfer Copy linkLink copied to clipboard!
Cancel ongoing state transfer operations with the ?action=cancel-push-state parameter.
POST /rest/v2/container/x-site/backups/{siteName}?action=cancel-push-state
POST /rest/v2/container/x-site/backups/{siteName}?action=cancel-push-state