cbstats tool
The cbstats tool is used to get node and cluster-level statistics about performance and items in storage.
Description
The cbstats tool is a per-node, per-bucket operation. That means that the IP address of a node in the cluster and a named bucket must be specified. If a named bucket is not provided, the server applies the setting to any default bucket that exists at the specified node. To perform this operation for an entire cluster, perform the command for every node/bucket combination that exists for that cluster.
The tool is found in the following locations:
Platform | Location |
---|---|
Linux | /opt/couchbase/bin/cbstats |
Windows | C:\Program Files\Couchbase\Server\bin\cbstats.exe |
Mac OS X | /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbstats |
CLI command and parameters
This tool is used to get the couchbase node statistics. The general format for this command is:
cbstats [host]:11210 [command] -b [bucket-name] -p [bucket-password]
The following are commands. The all and timings commands are used to understand cluster or node performance. The majority of these commands are predominately used by Couchbase internally and to help resolve customer support incidents.
all allocator checkpoint [vbid] config dcp dcp-takeover vb name dcpagg diskinfo [detail] dispatcher [logs] failovers [vbid] hash [detail] items (memcached bucket only) key keyname vbid kvstore kvtimings memory prev-vbucket raw argument reset runtimes scheduler slabs (memcached bucket only) tap [username password] tap-takeover vb name tapagg timings vbucket vbucket-detail [vbid] vbucket-seqno [vbid] vkey keyname vbid warmup workload
The following are command options:
Options | Description |
---|---|
-h, --help | Shows the help message and exits. |
-b [bucket-name] | The bucket to get the status from. Default: default |
-p [password] | The password for the bucket, if one exists. |
Syntax
Request syntax:
cbstats [host]:11210 [command]
Example: Timings
To get statistics, for example, timings on host 10.5.2.117:
cbstats 10.5.2.117:11210 timings
Response:
disk_commit (1024 total)
0 - 1s : (100.00%) 1024 ###################################################
Avg : ( 1s)
get_stats_cmd (30663276 total)
0 - 1us : ( 0.05%) 14827
1us - 2us : ( 6.56%) 1995778 ##
2us - 4us : ( 41.79%) 10804626 ##############
4us - 8us : ( 45.20%) 1044043 #
8us - 16us : ( 45.49%) 89929
16us - 32us : ( 45.90%) 124472
32us - 64us : ( 46.38%) 148935
64us - 128us : ( 56.17%) 2999690 ###
128us - 256us : ( 68.57%) 3804009 ####
256us - 512us : ( 69.91%) 411281
512us - 1ms : ( 78.77%) 2717402 ###
1ms - 2ms : ( 96.36%) 5391526 #######
2ms - 4ms : ( 99.05%) 826345 #
4ms - 8ms : ( 99.96%) 278727
8ms - 16ms : (100.00%) 11443
16ms - 32ms : (100.00%) 217
32ms - 65ms : (100.00%) 19
65ms - 131ms : (100.00%) 7
Avg : ( 347us)
disk_vbstate_snapshot (93280 total)
32us - 64us : ( 15.34%) 14308 ######
64us - 128us : ( 74.74%) 55413 #########################
128us - 256us : ( 91.39%) 15532 #######
256us - 512us : ( 95.69%) 4007 #
512us - 1ms : ( 99.49%) 3546 #
1ms - 2ms : ( 99.95%) 423
2ms - 4ms : ( 99.99%) 43
4ms - 8ms : (100.00%) 4
2s - 4s : (100.00%) 4
Avg : ( 190us)
notify_io (4 total)
4us - 8us : ( 25.00%) 1 ############
16us - 32us : ( 75.00%) 2 ########################
32us - 64us : (100.00%) 1 ############
Avg : ( 17us)
Example: Using with other CLI tools
The cbstats output can be used with other command-line tools to sort and filter the data, for example, the watch command.
watch --diff "cbstats \
ip-10-12-19-81:11210 -b bucket_name -p bucket_password all | egrep 'item|mem|flusher|ep_queue|bg|eje|resi|warm'"