DataStax OpsCenter Documentation

Performing Cluster Operations

Cluster operations include initiating administrative actions on nodes, such as garbage compaction, in a Cassandra or DSE cluster, rebalancing a cluster, and managing API requests sent to cluster.

Node Administration Methods URL
Initiate Java garbage compaction on a node. GET /{cluster_id}/ops/gc/{node_ip}
Assign a new token to the node. PUT /{cluster_id}/ops/move/{node_ip}
Flush all memtables from the node. GET /{cluster_id}/ops/drain/{node_ip}
Decommission a node. GET /{cluster_id}/ops/decommission/{node_ip}
Clean up a keyspace. POST /{cluster_id}/ops/cleanup/{node_ip}/{ks_name}
Flush memtables from a keyspace. POST /{cluster_id}/ops/flush/{node_ip}/{ks_name}
Repair a keyspace. POST /{cluster_id}/ops/repair/{node_ip}/{ks_name}
Perform compaction on a keyspace. POST /{cluster_id}/ops/compact/{node_ip}/{ks_name}

Ensure that each node in a Cassandra cluster is managing an equal amount of data using these methods.

Cluster Rebalancing Methods URL
List moves to balance a cluster. GET /{cluster_id}/ops/rebalance
Run a list of moves to balance a cluster. POST /{cluster_id}/ops/rebalance

Determine the status of Real-time Query operations in Cassandra using these methods.

Request Management Methods URL
Get the status of the request. GET /{cluster_id}/request/{request_id}/status
Cancel a request. POST /{cluster_id}/request/{request_id}/cancel

Node Administration Methods

GET /{cluster_id}/ops/gc/{node_ip}

Initiate Java garbage compaction on a Node.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- IP address of the target Node.

Returns null.

Example:

curl
  http://127.0.0.1:8888/Test_Cluster/ops/gc/1.2.3.4
  -X GET
PUT /{cluster_id}/ops/move/{node_ip}

Assign a new token to the node.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node to be assigned a new token.
Body :

New token to assign to node

Returns a Request ID, the ID returned by the API call that triggered the request.

Example:

curl
  http://127.0.0.1:8888/Test_Cluster/ops/move/10.11.12.72
  -X PUT
  -d '"85070591730234615865843651857942052864"'

Output:

"72ff69b2-9cf5-4777-a600-9173b3fe7e6a"
GET /{cluster_id}/ops/drain/{node_ip}

Initiate a drain operation to flush all memtables from the node.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node to be flushed of memtables.

Returns null.

Example:

curl
  http://127.0.0.1:8888/Test_Cluster/ops/drain/1.2.3.4
  -X GET
GET /{cluster_id}/ops/decommission/{node_ip}

Initiate decommissioning of a node.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node to be decommissioned.

Returns null.

Example:

curl
  http://127.0.0.1:8888/Test_Cluster/ops/decommission/1.2.3.4
  -X GET
POST /{cluster_id}/ops/cleanup/{node_ip}/{ks_name}

Initiate a cleanup operation for the specified keyspace.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node that initiates cleaning of the keyspace.
  • ks_name -- Name of the keyspace to be cleaned.
Body :

List of column families to cleanup. Empty = all column families.

Returns null.

Example

curl
  http://127.0.0.1:8888/Test_Cluster/ops/cleanup/1.2.3.4/Keyspace1
  -X POST
  -d '["ColFam1", "ColFam2"]'
POST /{cluster_id}/ops/flush/{node_ip}/{ks_name}

Flush memtables for a keyspace.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node to be flushed of memtables for a keyspace.
  • ks_name -- Keyspace of the memtables to be flushed.
Body :

List of column families to flush. Empty = all column families.

Returns null.

Example

curl
  http://127.0.0.1:8888/Test_Cluster/ops/flush/1.2.3.4/Keyspace1
  -X POST
  -d '["ColFam1", "ColFam2"]'
POST /{cluster_id}/ops/repair/{node_ip}/{ks_name}

Initiates repair of a keyspace.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node that initiates repair.
  • ks_name -- Keyspace to be repaired.
Body :

List of column families to repair. Empty = all column families.

Returns null.

Example

curl
  http://127.0.0.1:8888/Test_Cluster/ops/repair/1.2.3.4/Keyspace1
  -X POST
  -d '["ColFam1", "ColFam2"]'
POST /{cluster_id}/ops/compact/{node_ip}/{ks_name}

Initiates a major compaction on a keyspace.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • node_ip -- Node that initiates the compaction.
  • ks_name -- Keyspace to be compacted.
Body :

List of column families to compact. Empty = all column families.

Returns null.

Example

curl
  http://127.0.0.1:8888/Test_Cluster/ops/compact/1.2.3.4/Keyspace1
  -X POST
  -d '["ColFam1", "ColFam2"]'

Cluster Rebalancing Methods

GET /{cluster_id}/ops/rebalance

Return a list of proposed moves to run to balance a cluster.

Path arguments:cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.

Returns a list of moves, where each move is a token and the IP address of its assigned node. The result of this call is passed to POST /{cluster_id}/ops/rebalance.

Example

curl http://127.0.0.1:8888/Test_Cluster/ops/rebalance
  -X GET

Output:

[
  [
    "85070591730234615865843651857942052864",
    "10.11.12.152"
  ]
]
POST /{cluster_id}/ops/rebalance

Run the specified list of moves to balance a cluster.

Path arguments:cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
Query params:sleep -- An optional number of seconds to wait between each move.
Body :A list of moves to run to balance this cluster. This is typically the result of GET /{cluster_id}/ops/rebalance.

Returns a Request ID for determining the status of, or cancelling, a running rebalance.

Example

curl http://127.0.0.1:8888/Test_Cluster/ops/rebalance
  -X POST
  -d
  '[[
    "85070591730234615865843651857942052864",
    "10.11.12.152"
  ]]'

Output:

"e330b179-1b9f-40c2-a2f5-d2f3d24aa85c"

Request Management Methods

GET /{cluster_id}/request/{request_id}/status

Check the status of an asynchronous request sent to OpsCenter.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • request_id -- The ID returned by the API call that triggered the request.

Return a dictionary describing the status of the request.

Example

curl http://127.0.0.1:8888/Test_Cluster/request
  /6b6b15aa-df8a-43f1-aab3-efce6b8589e4/status
-X GET
{
  "status": "running",
  "started": 1334856122,
  "error_message": null,
  "finished": null,
  "moves": [
    {
     "status": null,
     "ip": "10.100.100.100",
     "old": "2",
     "new": "85070591730234615865843651857942052864"
    }
  ],
  "id": "6b6b15aa-df8a-43f1-aab3-efce6b8589e4"
}
POST /{cluster_id}/request/{request_id}/cancel

Cancel an asynchronous request sent to OpsCenter.

Path arguments:
  • cluster_id -- A key, which identifies the node's cluster, in the dictionary returned by GET /cluster-configs.
  • request_id -- The ID returned by the API call that triggered the request.

Returns null.

Example

curl http://127.0.0.1:8888/Test_Cluster/
  request/6b6b15aa-df8a-43f1-aab3-efce6b8589e4/cancel
  -X POST

The request is canceled.