©2015 -
COUCHBASE CLI TOOLS
Couchbase command line interface is a set of tools that provides monitoring utilities, querying tools, data loading tools and cluster management.
TABLE OF CONTENTS
N1QL Query Tool -
Data Loader Tool -
Launching Query Workbench Web Services
DATA LOADER TOOL -
JSON document loader tool. Reads *.json files stored on a directory or zip file.
Directory structure
Place the files into the following directories according to their type as designated below:
/design_docs # directory to place all the design docs for views.
/docs # directory to place all the json data files. This can contain other sub directories too.
Note that each json file is treated as a single json doc for which the filename will be used as a Key ID.
Available parameter options:
[couchbas@lxnode5 ~]$ cbdocloader -
Usage: cbdocloader [options] <directory>|zipfile
Example: cbdocloader -
Options:
-
-
-
-
-
-
[couchbas@lxnode5 ~]$
Note:
-
-
-
-
[couchbas@lxnode5 sample]$ cbdocloader -
[2016-
[2016-
[2016-
[2016-
bucket creation is successful
[couchbas@lxnode5 sample]$
[couchbas@lxnode5 sample]$ cbdocloader -
[2016-
[2016-
bucket creation is successful
.
bucket: gamesim-
: total | last | per sec
byte : 94693 | 94693 | 97976.1
done
[couchbas@lxnode5 sample]$
NOTE: The filename for each json doc becomes the Key ID in the bucket.
[couchbas@lxnode5 sample]$ ls gamesim-
Aaron0.json
Aaron1.json
Aaron2.json
Aliaksey0.json
Aliaksey1.json
Aliaksey2.json
...
... cut ...
...
[couchbas@lxnode5 sample]$
[couchbas@lxnode5 sample]$ cat gamesim-
{
"experience": 55,
"hitpoints": 10,
"jsonType": "player",
"level": 2,
"loggedIn": true,
"name": "Aaron2",
"uuid": "edc5aedf-
}
[couchbas@lxnode5 sample]$
[couchbas@lxnode4 ~]$ cbc cat Aaron2 -
Aaron2 CAS=0x26cf46673c14, Flags=0x0. Size=190
{
"experience": 55,
"hitpoints": 10,
"jsonType": "player",
"level": 2,
"loggedIn": true,
"name": "Aaron2",
"uuid": "edc5aedf-
}
[couchbas@lxnode4 ~]$
The Query Workbench is a browser based graphical tool used for N1QL queries and execution.
It usually is installed as a client in your development workstations and it supports the most common OS platforms such as Mac OS X, Windows and Linux.
Since this is a N1QL tool, buckets must have at least a primary index in order for the queries to work.
You may download the appropriate installer for your platform from Couchbase Download Site , select the "Tools" tab and look for the current release.
Keep in mind, since this is a browser based tool, it has a mini-
NOTE: At the time of this writing, the Couchbase Query Workbench is in Developer Preview release and is a separate tool. There were plans for it to be incorporated into the Couchbase Server Console on its v4.5+ release.
Features of the Query Workbench include:
An example of a Linux installation:
[couchbas@lxnode4 couchbase]$ gunzip couchbase-
[couchbas@lxnode4 couchbase]$ tar xvf couchbase-
NOTE: If Query Workbench is installed remotely from the Couchbase cluster, the configuration for node connection has to be on a host that runs the Query Service and appropriate firewall ports need to opened between the client and the CB cluster.
[couchbas@lxnode4 couchbase]$ cd couchbase-
[couchbas@lxnode4 couchbase-
cbq-
[couchbas@lxnode4 couchbase-
total 15840
-
-
-
drwxr-
[couchbas@lxnode4 couchbase-
[couchbas@lxnode4 couchbase-
Replace COUCHBASE_URL=http://127.0.0.1:8091 with your cluster node host and port.
In my case, it would be COUCHBASE_URL=http://lxnode5.vlabs.net:8091
This is an example of running the Query workbench web services in Linux:
[couchbas@lxnode4 couchbase-
Running: ./cbq-
Launching query web service.
Using CB Server at: http://lxnode5.vlabs.net:8091
Using N1QL query service on: lxnode5.vlabs.net:8093
Using memcached service on: lxnode5.vlabs.net:11210
Using memcached service on: 172.16.33.89:11210
Using web content at: ./static
Launching UI server, to use, point browser at http://localhost:8094