Overview
The Analytics Administration REST APIs are provided by the Analytics service. These APIs enables you to manage and monitor the Analytics service.
The API schemes and host URLs are as follows:
-
https://node:18095/ (for secure access)
where node
is the host name or IP address of a node running the Analytics service.
Paths
This section describes the operations available with these REST APIs.
Request Cancellation
DELETE /analytics/admin/active_requests
Parameters
Type | Name | Description | Schema |
---|---|---|---|
FormData |
client_context_id |
Identifier passed by the client that is used to identify an active request to be cancelled. |
string |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
The operation was successful. |
No Content |
400 |
Bad request. Incorrect parameter or missing value. |
No Content |
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect, or there is no active request with the specified identifier. |
No Content |
Example HTTP request
The example below uses the client_context_id
used in the Query Service example to identify the request.
curl -v -u Administrator:password -X DELETE \
http://localhost:8095/analytics/admin/active_requests \
-d client_context_id=xyz
Cluster Status
GET /analytics/cluster
Description
Shows various details about the current status of the Analytics Service, such as the service state, the state of each node partition, and the replicas of each partition.
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
Success. Returns an object giving the current status of the Analytics Service. |
|
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect. |
No Content |
Example HTTP request
curl -v -u Administrator:password http://localhost:8095/analytics/cluster
Example HTTP response
{
"authorizedNodes": [
"86586a966202b5aa4aed31633f330aba",
"948fb3af810a9b7bc6c76e2a69ba35d9"
],
"ccNodeId": "86586a966202b5aa4aed31633f330aba",
"nodeConfigUri": "/analytics/config/node",
"nodeDiagnosticsUri": "/analytics/node/diagnostics",
"nodeRestartUri": "/analytics/node/restart",
"nodeServiceUri": "/analytics/service",
"nodes": [
{
"apiBase": "http://192.168.8.101:8095",
"apiBaseHttps": "https://192.168.8.101:18095",
"nodeId": "86586a966202b5aa4aed31633f330aba",
"nodeName": "192.168.8.101:8091"
},
{
"apiBase": "http://192.168.8.102:8095",
"apiBaseHttps": "https://192.168.8.102:18095",
"nodeId": "948fb3af810a9b7bc6c76e2a69ba35d9",
"nodeName": "192.168.8.102:8091"
}
],
"partitions": [
{
"active": true,
"activeNodeId": "86586a966202b5aa4aed31633f330aba",
"iodeviceNum": 0,
"nodeId": "86586a966202b5aa4aed31633f330aba",
"partitionId": 0,
"path": "/data/@analytics/v_iodevice_0",
"pendingActivation": false
},
{
"active": true,
"activeNodeId": "948fb3af810a9b7bc6c76e2a69ba35d9",
"iodeviceNum": 0,
"nodeId": "948fb3af810a9b7bc6c76e2a69ba35d9",
"partitionId": 1,
"path": "/data/@analytics/v_iodevice_0",
"pendingActivation": false
}
],
"partitionsTopology": {
"balanced": true,
"ccNodeId": "86586a966202b5aa4aed31633f330aba",
"metadataPartition": -1,
"numReplicas": 1,
"partitions": [
{
"id": "0",
"master": "86586a966202b5aa4aed31633f330aba",
"origin": "86586a966202b5aa4aed31633f330aba",
"replicas": [
{
"location": "192.168.8.102:9120",
"nodeId": "948fb3af810a9b7bc6c76e2a69ba35d9",
"status": "IN_SYNC",
"syncProgress": "1"
}
]
},
{
"id": "1",
"master": "948fb3af810a9b7bc6c76e2a69ba35d9",
"origin": "948fb3af810a9b7bc6c76e2a69ba35d9",
"replicas": [
{
"location": "192.168.8.101:9120",
"nodeId": "86586a966202b5aa4aed31633f330aba",
"status": "IN_SYNC",
"syncProgress": "1"
}
]
},
{
"id": "-1",
"master": "86586a966202b5aa4aed31633f330aba",
"origin": "86586a966202b5aa4aed31633f330aba",
"replicas": [
{
"location": "192.168.8.102:9120",
"nodeId": "948fb3af810a9b7bc6c76e2a69ba35d9",
"status": "IN_SYNC",
"syncProgress": "1"
}
]
}
],
"revision": 1,
"version": 1
},
"serviceConfigUri": "/analytics/config/service",
"serviceDiagnosticsUri": "http://localhost:8095/analytics/cluster/diagnostics",
"serviceRestartUri": "http://localhost:8095/analytics/cluster/restart",
"state": "ACTIVE"
}
Cluster Restart
POST /analytics/cluster/restart
Responses
HTTP Code | Description | Schema |
---|---|---|
202 |
Accepted. Returns an object showing the status of the cluster. |
object |
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect. |
No Content |
Example HTTP request
curl -v -u Administrator:password -X POST http://localhost:8095/analytics/cluster/restart
Example HTTP response
{
"cluster" : {
"metadata_node" : "edfb6de9c91d7fb36399fea3ce620c5c",
"ncs" : [ {
"node_id" : "edfb6de9c91d7fb36399fea3ce620c5c",
"partitions" : [ {
"active" : true,
"partition_id" : "partition_0"
} ],
"pid" : 5763,
"state" : "ACTIVE"
} ],
"state" : "ACTIVE"
},
"date" : "Wed Oct 10 15:35:56 BST 2018",
"status" : "SHUTTING_DOWN"
}
Node Restart
POST /analytics/node/restart
Responses
HTTP Code | Description | Schema |
---|---|---|
202 |
Accepted. Returns an object showing the status of the node. |
object |
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect. |
No Content |
Ingestion Status
GET /analytics/status/ingestion
Description
Shows the progress of ingestion by the Analytics service, for each Analytics collection.
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
Success. Returns an object giving the ingestion status of each Analytics collection. |
|
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect. |
No Content |
Example HTTP request
curl -v -u Administrator:password http://localhost:8095/analytics/status/ingestion
Example HTTP response
{
"links": [
{
"name": "Local",
"scope": "travel-sample/tenant_agent_02",
"status": "healthy",
"state": [
{
"timestamp": 1631107234921,
"progress": 1,
"scopes": [
{
"collections": [
{
"name": "users"
}
],
"name": "travel-sample/tenant_agent_02"
}
]
}
]
},
{
"name": "Local",
"scope": "travel-sample/inventory",
"status": "healthy",
"state": [
{
"timestamp": 1631107234921,
"progress": 1,
"scopes": [
{
"collections": [
{
"name": "airport"
},
{
"name": "landmark"
}
],
"name": "travel-sample/inventory"
}
]
},
{
"timestamp": 1631107234921,
"progress": 0.9821428571428571,
"timeLag": 4840,
"itemsProcessed": 23595,
"seqnoAdvances": 49129,
"scopes": [
{
"collections": [
{
"name": "route"
}
],
"name": "travel-sample/inventory"
}
]
}
]
}
]
}
Pending Mutations
GET /analytics/node/agg/stats/remaining
operation.deprecated |
Description
Shows the number of mutations in the DCP queue that have not yet been ingested by the Analytics service, for each Analytics collection.
This endpoint may not return meaningful results in Couchbase Server 7.0 and later. The reported number of mutations may be different to the actual number of mutations in the Analytics collection. For this reason, this endpoint has been deprecated, and you should use the Ingestion Status endpoint instead. |
Responses
HTTP Code | Description | Schema |
---|---|---|
200 |
Success. Returns an object giving the number of pending mutations for each Analytics collection. |
|
401 |
Unauthorized. The user name or password may be incorrect. Returns an object containing an error message. Refer to Error Codes. |
object |
404 |
Not found. The path may be incorrect. |
No Content |
Definitions
This section describes the properties returned by these REST APIs.
Status
An object giving information about the status of the Analytics service.
Name | Description | Schema |
---|---|---|
authorizedNodes |
An array of strings, each of which is the ID of an authorized Analytics node. |
< string > array |
ccNodeId |
The ID of the cluster controller node. |
string |
nodeConfigUri |
The path of the Analytics Node Configuration REST API. |
string |
nodeDiagnosticsUri |
The path of the Analytics Node Diagnostics REST API. For internal use only. |
string |
nodeRestartUri |
The path of the Analytics Node Restart REST API. |
string |
nodeServiceUri |
The path of the Analytics Query Service REST API. |
string |
serviceConfigUri |
The path of the Analytics Service Configuration REST API. |
string |
serviceDiagnosticsUri |
The full URI of the Analytics Service Diagnostics REST API. For internal use only. |
string |
serviceRestartUri |
The full URI of the Analytics Cluster Restart REST API. |
string |
state |
The state of the Analytics Service. |
enum (ACTIVE, REBALANCE_REQUIRED, UNUSABLE, SHUTTING_DOWN) |
nodes |
An array of objects, each giving information about one Analytics node. |
< Nodes > array |
partitions |
An array of objects, each giving information about one Analytics partition. |
< Partitions > array |
partitionsTopology |
An object giving information about the partition topology. |
Nodes
Name | Description | Schema |
---|---|---|
apiBase |
The URI scheme, host, and port for HTTP access to Analytics REST APIs on this node. |
string |
apiBaseHttps |
The URI scheme, host, and port for secure HTTPS access to Analytics REST APIs on this node. |
string |
nodeId |
The ID of the node. |
string |
nodeName |
The name or IP address of the node, including the cluster administration port. |
string |
Partitions
Name | Description | Schema |
---|---|---|
active |
Indicates whether this partition is active. |
boolean |
activeNodeId |
The ID of the node where this partition is currently active. |
string |
iodeviceNum |
The number of the IO Device where this partition is located. |
integer |
nodeId |
The ID of the node where this partition originated. |
string |
partitionId |
The ID of this partition. |
integer |
path |
The path of the IO Device where this partition is located. |
string |
pendingActivation |
Indicates whether this partition is waiting to become active. |
boolean |
Partition Topology
Name | Description | Schema |
---|---|---|
balanced |
Indicates whether the Analytics nodes are balanced. |
boolean |
ccNodeId |
The ID of the cluster controller node. |
string |
metadataPartition |
The ID of the metadata partition. |
integer |
numReplicas |
The number of Analytics replicas. |
integer |
revision |
The revision number of the partition topology. |
integer |
version |
The version number of the partition topology. |
integer |
partitions |
An array of objects, each giving information about the state of one Analytics partition. |
< Partition States > array |
Partition States
Name | Description | Schema |
---|---|---|
id |
The partition ID. |
integer |
master |
The ID of the node where the partition is currently active. |
string |
origin |
The ID of the node where the partition originated. |
string |
replicas |
An array of objects, each giving information about the state of one Analytics replica. |
< Replicas > array |
Replicas
Name | Description | Schema |
---|---|---|
location |
The name or IP address of the node where this replica is located, including the Analytics replication port. |
string |
nodeId |
The ID of the node where this replica is located. |
string |
status |
The synchronization status of the replica. |
enum (IN_SYNC, CATCHING_UP, DISCONNECTED) |
syncProgress |
The percentage (fraction from 0 to 1) of synchronization progress for this replica at the current time. |
number (double) |
Ingestion
An object containing a single links property.
Name | Description | Schema |
---|---|---|
links |
An array of objects, each giving information about a single linked Analytics scope. |
< Links > array |
Links
Name | Description | Schema |
---|---|---|
name |
The name of the link. |
string |
scope |
The name of the Analytics scope. |
string |
status |
The status of the Analytics scope. |
enum (healthy, stopped, unhealthy, suspended) |
state |
An array of objects, each giving the ingestion state of one or more Analytics collections. Analytics collections which have the same ingestion state within this Analytics scope are aggregated together. |
< States > array |
States
Name | Description | Schema |
---|---|---|
timestamp |
The time since epoch that this sample was calculated, in milliseconds. |
integer |
progress |
The percentage (fraction from 0 to 1) of ingestion progress at the current time. |
number (double) |
timeLag |
The estimated time that the ingestion lags behind the Data service, in milliseconds. Only displayed for Analytics collections that are not fully ingested. |
integer |
itemsProcessed |
The number of items ingested since last connect; that is, the total number of mutations and deletions processed. Only displayed for Analytics collections that are not fully ingested. Note that this value is reset on connect, so it may appear to get smaller. |
integer |
seqnoAdvances |
The change in sequence number (seqno) since last connect. Only displayed for Analytics collections that are not fully ingested. |
integer |
scopes |
An array of objects, each one giving information about a single Analytics scope. |
< State Scopes > array |
State Scopes
Name | Description | Schema |
---|---|---|
name |
The name of the Analytics scope. |
string |
collections |
An array of objects, each one giving information about a single Analytics collection. |
< State Collections > array |
State Collections
Name | Description | Schema |
---|---|---|
name |
The name of the Analytics collection. |
string |
Mutations
An object containing one or more nested scope objects, one for each available Analytics scope.
Name | Description | Schema |
---|---|---|
scope |
An object containing one or more collection properties, one for each Analytics collection in the Analytics scope. The name of the object is the name of the Analytics scope, in display form. |
Collections
Name | Description | Schema |
---|---|---|
collection |
The number of mutations in the DCP queue that have not yet been ingested. The name of the property is the name of the Analytics collection. |
integer |
Security
The Analytics Administration REST APIs support HTTP basic authentication. Credentials can be passed via HTTP headers.
Analytics Manage / Analytics Select
For the Request Cancellation, Ingestion Status, and Pending Mutations operations, users must have one of the following access roles:
-
Full Admin
-
Cluster Admin
-
Analytics Manager
-
Analytics Reader
-
Analytics Select
-
Analytics Admin
Type : basic
Cluster Read / Pools Read
For the Cluster Status operation, users must have one of the following access roles:
-
Full Admin
-
Cluster Admin
-
Read-Only Admin
-
Analytics Admin
Type : basic
Analytics Manage
For the Cluster Restart and Node Restart operations, users must have one of the following RBAC roles:
-
Full Admin
-
Cluster Admin
-
Analytics Admin
Type : basic
Refer to Roles for more details.