couchbase-cli

couchbase-cli

The couchbase-cli tool is used to perform operations both on single nodes or on entire clusters.

Syntax

The basic syntax is:

couchbase-cli COMMAND CLUSTER [options]		

Where:

  • COMMAND is a CLI command.
  • CLUSTER is a cluster specification. The following shows both short and long form syntax:
// Short form
    -c [host]:[port]
// Long form
    --cluster=[host]:[port]

Description

The couchbase-cli tool is located in the specific paths, depending on the platform. It can perform operations on an entire cluster, on a bucket shared across an entire cluster, or on a single node in a cluster. For instance, if this tool is used to create a bucket, all nodes in the cluster have access to the bucket.

Note: Many of the couchbase-cli commands can be performed using the REST API reference.

Options

The following are the command options:

Table 1. couchbase-cli options
Option Description
-u USERNAME, --user=USERNAME Admin username of the cluster.
-p PASSWORD, --password=PASSWORD Admin password of the cluster.
-o KIND, --output=KIND Type of document: JSON or standard.
-d, --debug Output debug information.
-h, --help Help information.
-s, --ssl Uses SSL for communication with secure servers.
Note: The username can be set in the environment variable CB_REST_USERNAME and the password can be set in the environment variable CB_REST_PASSWORD.

Example

List the buckets in a cluster:

export CB_REST_USERNAME=Administrator; export CB_REST_PASSWORD=mypasswd; \
/opt/couchbase/bin/couchbase-cli bucket-list -c localhost:8091