The purpose of our article is to install Couchbase Cluster via CLI. We can also install the cluster over the UI, but we will perform these operations over the CLI first.
As a first step, Couchbase Server must be installed on the servers where we will install Cluster. You can access the answer of how to install Couchbase Server from the below article.
“How To Install Couchbase Server on Ubuntu 16.04”
We have two servers whose couchbase installations have been completed and we will start with Cluster Initialize as a first step. Here we start operations on our first machine.
Cluster-Init Syntax
1 2 3 4 5 6 7 8 |
couchbase-cli cluster-init [--cluster <url>] [--cluster-username <username>] [--cluster-password <password>] [--cluster-port <port>] [--cluster-ramsize <megabytes>] [--cluster-name <name>] [--cluster-index-ramsize <megabytes>] [--cluster-fts-ramsize <megabytes>] [--cluster-eventing-ramsize <megabytes>] [--cluster-analytics-ramsize <megabytes>] [--index-storage-setting <setting>] [--services <services>] DESCRIPTION |
1 |
./couchbase-cli cluster-init -c <IP_Address> --cluster-username Administrator --cluster-password Abc12345 --services data,index,query --cluster-ramsize 2048 --cluster-index-ramsize 256 --cluster-name SQLTR-DEMO |
We added Node to Cluster.
After adding node, we need to start Rebalance and activate the node in Cluster.
Rebalance syntax
1 2 3 |
couchbase-cli rebalance [--cluster <url>] [--username <user>] [--password <password>] [--server-remove <servers>] [--no-progress-bar] [--no-wait] |
1 2 |
./couchbase-cli rebalance --cluster=<IP_Address>:8091 --user Administrator --password Abc12345 SUCCESS: Rebalance complete |
List couchbase clusters nodes
We will see our node list and their status.
1 |
./couchbase-cli server-list --cluster=<IP_Address>:8091 --user Administrator --password Abc12345 |
Create Bucket
We use our bucket-create function.
Bucket-create syntax:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
couchbase-cli bucket-create [--cluster <url>] [--username <user>] [--password <password>] [--bucket <name>] [--bucket-type <type>] [--bucket-ramsize <size>] [--bucket-replica <num>] [--bucket-priority <priority>] [--bucket-eviction-policy <policy>] [--max-ttl <seconds>] [--compression-mode <mode>] [--enable-flush <num>] [--enable-index-replica <num>] [--conflict-resolution <type>] [--wait] [--database-fragmentation-threshold-percentage <perc>] [--database-fragmentation-threshold-size <megabytes>] [--view-fragmentation-threshold-percentage <perc>] [--view-fragmentation-threshold-size <megabytes>] [--from-hour <hour>] [--from-minute <min>] [--to-hour <hour>] [--to-minute <min>] [--abort-outside <0|1>] [--parallel-db-view-compaction <0|1>] [--purge-interval <float>] |
For our example, we prepare the script as follows.
1 |
./couchbase-cli bucket-create --cluster=<IP_Address>:8091 --user Administrator --password Abc12345 --bucket demo --bucket-type couchbase --bucket-ramsize 100 --bucket-replica 1 --compression-mode active |