Back to Redis

Actions

content/operate/rs/7.4/references/rest-api/requests/cluster/actions.md

latest5.6 KB
Original Source
MethodPathDescription
GET/v1/cluster/actionsGet the status of all actions
GET/v1/cluster/actions/{action}Get the status of a specific action
POST/v1/cluster/actions/{action}Initiate a cluster-wide action
DELETE/v1/cluster/actions/{action}Cancel action or remove action status

Get all cluster actions {#get-all-cluster-actions}

GET /v1/cluster/actions

Get the status of all currently executing, queued, or completed cluster actions.

Required permissions

Permission name
[view_status_of_cluster_action]({{< relref "/operate/rs/7.4/references/rest-api/permissions#view_status_of_cluster_action" >}})

Request {#get-all-request}

Example HTTP request

GET /v1/cluster/actions

Response {#get-all-response}

Returns a JSON array of [action objects]({{< relref "/operate/rs/7.4/references/rest-api/objects/action" >}}).

Example JSON body

json
{
    "actions": [
        {
            "name": "action_name",
            "status": "queued",
            "progress": 0.0
        }
    ]
}

Status codes {#get-all-status-codes}

CodeDescription
200 OKNo error, response provides info about an ongoing action.
404 Not FoundAction does not exist (i.e. not currently running and no available status of last run).

Get cluster action {#get-cluster-action}

GET /v1/cluster/actions/{action}

Get the status of a currently executing, queued, or completed cluster action.

Required permissions

Permission name
[view_status_of_cluster_action]({{< relref "/operate/rs/7.4/references/rest-api/permissions#view_status_of_cluster_action" >}})

Request {#get-request}

Example HTTP request

GET /v1/cluster/actions/action_name

URL parameters

FieldTypeDescription
actionstringThe action to check.

Response {#get-response}

Returns an [action object]({{< relref "/operate/rs/7.4/references/rest-api/objects/action" >}}).

Example JSON body

json
{
    "name": "action_name",
     "status": "queued",
    "progress": 0.0
}

Status codes {#get-status-codes}

CodeDescription
200 OKNo error, response provides info about an ongoing action.
404 Not FoundAction does not exist (i.e. not currently running and no available status of last run).

Initiate cluster-wide action {#post-cluster-action}

POST /v1/cluster/actions/{action}

Initiate a cluster-wide action.

The API allows only a single instance of any action type to be invoked at the same time, and violations of this requirement will result in a 409 CONFLICT response.

The caller is expected to query and process the results of the previously executed instance of the same action, which will be removed as soon as the new one is submitted.

Required permissions

Permission name
[start_cluster_action]({{< relref "/operate/rs/7.4/references/rest-api/permissions#start_cluster_action" >}})

Request {#post-request}

Example HTTP request

POST /v1/cluster/actions/action_name

URL parameters

FieldTypeDescription
actionstringThe name of the action required.

Supported cluster actions:

  • change_master: Promotes a specified node to become the primary node of the cluster, which coordinates cluster-wide operations. Include the node_uid of the node you want to promote in the request body.

    sh
    POST /v1/cluster/actions/change_master
    {
        "node_uid": "2"
    }
    

Response {#post-response}

The body content may provide additional action details. Currently, it is not used.

Status codes {#post-status-codes}

CodeDescription
200 OKNo error, action was initiated.
400 Bad RequestBad action or content provided.
409 ConflictA conflicting action is already in progress.

Cancel action {#delete-cluster-action}

DELETE /v1/cluster/actions/{action}

Cancel a queued or executing cluster action, or remove the status of a previously executed and completed action.

Required permissions

Permission name
[cancel_cluster_action]({{< relref "/operate/rs/7.4/references/rest-api/permissions#cancel_cluster_action" >}})

Request {#delete-request}

Example HTTP request

DELETE /v1/cluster/actions/action_name

URL parameters

FieldTypeDescription
actionstringThe name of the action to cancel, currently no actions are supported.

Response {#delete-response}

Returns a status code.

Status codes {#delete-status-codes}

CodeDescription
200 OKAction will be cancelled when possible.
404 Not FoundAction unknown or not currently running.