key
Provides information on keys.
Description
The following key information is available.
Stat | Description | K/V |
---|---|---|
|
The key’s current cas value, as a decimal integer. |
KV |
|
Expiration time from the epoch, as a decimal integer. |
KV |
|
Flags for this key, as a decimal integer. |
KV |
|
If the value is not yet persisted. |
KV |
|
If the value is resident in memory. |
KV |
|
See description below. * |
V |
|
The vBucket state of this key. |
KV |
*key_valid
can have the following responses:
this_is_a_bug
-
Some case we didn’t take care of.
dirty
-
The value in memory has not been persisted yet.
length_mismatch
-
The key length in memory doesn’t match the length on the disk.
data_mismatch
-
The data in memory doesn’t match the data on disk.
flags_mismatch
-
The flags in memory don’t match the flags on disk.
valid
-
The key is both on disk and in memory.
ram_but_not_disk
-
The value doesn’t exist yet on disk.
item_deleted
-
The item has been deleted.
Options
Option | Description |
---|---|
|
Name of the key. |
|
vBucket ID. † |
† To find the vBucket ID associated with a given key, you can use the cbc-hash
command, which is available as part of the Couchbase C SDK (libcouchbase
).
-
For more information on the Couchbase C SDK, see c-sdk::start-using-sdk.adoc.
-
For more information on the
cbc-hash
command, see Couchbase C Client: cbc(1) - Couchbase Client Commandline Utility.
For common cbstats
options, see cbstats
.
Example 1: Find the vBucket ID associated with a given key
Request
cbc-hash 21st_amendment_brewery_cafe -U couchbase://localhost/beer-sample -u Administrator -P password
Response
21st_amendment_brewery_cafe: [vBucket=553, Index=1] Server: 10.142.180.102:11210, CouchAPI: http://10.142.180.102:8092/beer-sample Replica #0: Index=0, Host=10.142.180.101:11210
Example 2: Get key information
Request
cbstats localhost:11210 -u Administrator -p password -b beer-sample key 21st_amendment_brewery_cafe 553
Response
stats for key 21st_amendment_brewery_cafe key_cas: 1532081261254082560 key_exptime: 0 key_flags: 2 key_is_dirty: false key_is_resident: true key_vb_state: replica