Small immersive Couchbase Server CLI
npm install cbcluster``---.| |---'|
| | |
,---.|---.,---.| . .,---.|--- ,---.,---.
| | || | | |---'---'---'---'---'---'---'---'`
cbcluster is a small immersive command line utility for interacting with
Couchbase Server clusters.
Development is ongoing to mirror some of the examples shown in the
REST API Reference documentation. The primary focus of this tool is
compact commands for quick cluster interaction.
With NPM:
``
npm install -g cbcluster
From this repository:
``
git clone https://github.com/brianshumate/cbcluster.git
cd cbcluster
npm install
npm link
Start cbcluster:
``
cbcluster
Get help:
`
cbcluster> help
Commands:
addn [options] Add node to existing cluster
bckt [options] Create bucket
ejct [options] Eject node from cluster
flvr [options] Fail over node
info [options] Get Couchbase Server information
init [options] Initialize node
name [options] Specify node name
rebl [options] Rebalance cluster
svcs [options] Specify node services
user [options] Specify administrator username and password
help [command] Provides help for a given command
exit [options] Exits this instance of cbcluster
`
You can also get help for individual commands with help .
For the sake of convenience, cbcluster includes some sensible defaults
and the defaults (for e.g. bucket creation) which you will find in the
Couchbase Server web console user interface:
| Default setting | Value | Notes |
| ---------------------- | --------------- | ----------------------------|
| Administrator username | Administrator | [string] can be overridden with -u |-p
| Administrator password | couchbase | [string] can be overridden with |-d
| Node data path | /opt/couchbase/var/lib/couchbase/data | [string] can be overridden with |-i
| Node index path | /opt/couchbase/var/lib/couchbase/index | [string] can be overridden with |-x 18091
| Node port | 8091 | [int] can be overridden with |-t memcached
| Bucket type | membase | [string] can be overridden with note that membase is the name for a couchbase style bucket; the other option is memcached |-e fullEviction
| Per Node RAM Quota | 128 | [int] RAM quota per node for bucket (in megabytes) |
| Cache metadata | valueOnly | [string] can be overridden with |-a none
| Access control | sasl | [string] can be overridden with |-d 11242
| Bucket port | None | Set a bucket auth port number with |-r 3
| Replicas | 1 | [int] can be overridden with (2,3) |-i
| Index replicas | 0 | [0 or 1] can be overridden with |-c
| Auto compaction | 0 | [0 or 1] can be overridden with |-f
| Flush | 0 | [0 or 1] can be overridden with |
All the above defaults can of course be overridden by command options.
This example follows the Creating a new cluster documentation and covers most of the current abilities available in
cbcluster.
#### Couchbase Server Version
Determine the Couchbase Server version on a given cluster node:
``
cbcluster> vers -h cb1.local
SUCCESS: Couchbase Server node cb1.local version: 3.1.1-1807-rel-enterprise
#### Initialize Node
The first step in building a cluster is to initialize the node:
``
cbcluster> init -h cb3.local
SUCCESS: Initialized node: cb3.local
#### Specify Node Name
``
cbcluster> name -h cb3.local -n cb3.local
SUCCESS: Named node: cb3.local
#### Specify Node Services
``
cbcluster> svcs -h cb3.local -s kv,n1ql
SUCCESS: Specified services on node cb3.local: kv,n1ql
#### Specify Administrator Username and Password
``
user -h cb3.local -u Administrator -p tacotown
SUCCESS: Set administrator on node cb3.local: Administrator
#### Create Bucket
``
cbcluster> bckt -h cb3.local -p tacotown -n tacos -m 128 -s secretsalsa
SUCCESS: Created tacos bucket on node cb3.local
#### Fail Node Over and Rebalance Out
This example shows how to fail a node over, eject it from the cluster, and
then perform a rebalance; this makes the failed over node no longer a
cluster member.
```
cbcluster> flvr -h cb1.local -t cb2.local
SUCCESS: Node cb2.local failed over
cbcluster> ejct -h cb1.local -t cb2.local
SUCCESS: Node cb2.local ejected from cluster
cbcluster> rebl -h cb1.local -k cb1.local,cb3.local
SUCCESS: Cluster rebalancing
This project works with the following software:
* Couchbase Server 3.x-4.x
* Node.js 4.2.2
1. Creating a new cluster
2. Adding nodes to clusters
3. Buckets API
4. Removing nodes from clusters
5. Failing over nodes
6. Rebalancing nodes