Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 163 lines (129 sloc) 5.23 KB
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
def commands_usage():
return """
server-list list all servers in a cluster
server-info show details on one server
server-add add one or more servers to the cluster
server-readd readd a server that was failed over
rebalance start a cluster rebalancing
rebalance-stop stop current cluster rebalancing
rebalance-status show status of current cluster rebalancing
failover failover one or more servers
cluster-init set the username,password and port of the cluster
node-init set node specific parameters
bucket-list list all buckets in a cluster
bucket-create add a new bucket to the cluster
bucket-edit modify an existing bucket
bucket-delete delete an existing bucket
bucket-flush flush a given bucket
help show longer usage/help and examples
def short_usage():
print "usage: couchbase-cli COMMAND CLUSTER [OPTIONS]"
print ""
print "CLUSTER is --cluster=HOST[:PORT] or -c HOST[:PORT]"
print ""
print "COMMANDs include" + commands_usage()
def usage(error_msg=''):
if error_msg:
print "ERROR: %s" % error_msg
print """couchbase-cli - command-line cluster administration tool
usage: couchbase-cli COMMAND CLUSTER [OPTIONS]
COMMAND:""" + commands_usage() + """
--cluster=HOST[:PORT] or -c HOST[:PORT]
-u USERNAME, --user=USERNAME admin username of the cluster
-p PASSWORD, --password=PASSWORD admin password of the cluster
-o KIND, --output=KIND KIND is json or standard
-d, --debug
server-add OPTIONS:
--server-add=HOST[:PORT] server to be added
--server-add-username=USERNAME admin username for the
server to be added
--server-add-password=PASSWORD admin password for the
server to be added
server-readd OPTIONS:
--server-add=HOST[:PORT] server to be added
--server-add-username=USERNAME admin username for the
server to be added
--server-add-password=PASSWORD admin password for the
server to be added
rebalance OPTIONS:
--server-add* see server-add OPTIONS
--server-remove=HOST[:PORT] the server to be removed
failover OPTIONS:
--server-failover=HOST[:PORT] server to failover
cluster-init OPTIONS:
--cluster-init-username=USER new admin username
--cluster-init-password=PASSWORD new admin password
--cluster-init-port=PORT new cluster REST/http port
--cluster-init-ramsize=RAMSIZEMB per node ram quota in MB
node-init OPTIONS:
--node-init-data-path=PATH per node path to store data
bucket-* OPTIONS:
--bucket=BUCKETNAME bucket to act on
--bucket-type=TYPE memcached or couchbase
--bucket-port=PORT supports ASCII protocol and is auth-less
--bucket-password=PASSWORD standard port, exclusive with bucket-port
--bucket-ramsize=RAMSIZEMB ram quota in MB
--bucket-replica=COUNT replication count
The default PORT number is 8091.
List servers in a cluster:
couchbase-cli server-list -c
Server information:
couchbase-cli server-info -c
Add a node to a cluster, but do not rebalance:
couchbase-cli server-add -c \\
Add a node to a cluster and rebalance:
couchbase-cli rebalance -c \\
Remove a node from a cluster and rebalance:
couchbase-cli rebalance -c \\
Remove and add nodes from/to a cluster and rebalance:
couchbase-cli rebalance -c \\
--server-remove= \\
Stop the current rebalancing:
couchbase-cli rebalance-stop -c
Change the username, password, port and ram quota:
couchbase-cli cluster-init -c \\
--cluster-init-username=Administrator \\
--cluster-init-password=password \\
--cluster-init-port=8080 \\
Change the data path:
couchbase-cli node-init -c \\
List buckets in a cluster:
couchbase-cli bucket-list -c
Create a new dedicated port couchbase bucket:
couchbase-cli bucket-create -c \\
--bucket=test_bucket \\
--bucket-type=couchbase \\
--bucket-port=11222 \\
--bucket-ramsize=200 \\
Create a new sasl memcached bucket:
couchbase-cli bucket-create -c \\
--bucket=test_bucket \\
--bucket-type=memcached \\
--bucket-password=password \\
Modify a dedicated port bucket:
couchbase-cli bucket-edit -c \\
--bucket=test_bucket \\
--bucket-port=11222 \\
Delete a bucket:
couchbase-cli bucket-delete -c \\
Something went wrong with that request. Please try again.