{"id":1578,"date":"2014-12-16T19:25:42","date_gmt":"2014-12-16T19:25:42","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1578"},"modified":"2020-09-10T11:43:39","modified_gmt":"2020-09-10T18:43:39","slug":"couchbase-tools-shipped-couchbase-c-client-library-libcouchbase","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/","title":{"rendered":"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)"},"content":{"rendered":"<p>In this blog post, I will reveal some the less known features of the libcouchbase client library. It describes the libcouchbase tools which are collectively under\u00a0<a href=\"https:\/\/github.com\/couchbase\/libcouchbase\/blob\/master\/tools\/cbc.cc\">cbc<\/a>, the command originally written by Trond Norbye. You probably won\u2019t use them for writing you high-level bindings or implementing your application, but they still useful in many ways. \u00a0They&#8217;re a great example of libcouchbase usage, they&#8217;re useful as diagnotic or debug tooling or you can even use them in your scripts.<\/p>\n<p>Because there is a current release (1.0) of libcouchbase and a developer preview of the next release (1.1) which supports the new functionality coming in Couchbase Server 2.0, I will describe the 1.1 preview and will note which features are not accessible in current version.<\/p>\n<p><span class=\"error\">[Edit]<\/span>\u00a0This blog was written for the new functionality in the tools shipping with libcouchbase 2.0. The latest version is now 3.0, and you can find out how to install it at\u00a0<a class=\"external-link\" href=\"https:\/\/docs.couchbase.com\/c-sdk\/3.0\/hello-world\/start-using-sdk.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/docs.couchbase.com\/c-sdk\/3.0\/hello-world\/start-using-sdk.html<\/a>\u00a0and read a little more about the latest version of the tools at\u00a0<a class=\"external-link\" href=\"https:\/\/docs.couchbase.com\/c-sdk\/3.0\/hello-world\/cbc.html#command-line\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/docs.couchbase.com\/c-sdk\/3.0\/hello-world\/cbc.html#command-line<\/a><\/p>\n<p>After installation you will have the cbc command available and you can check the installed version:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc version<br \/>\ncbc built from: libcouchbase 1.1.0dp8<br \/>\nusing libcouchbase: 1.1.0dp8<\/div>\n<\/div>\n<p>Note that as of this writing, the currently released version is actually 1.1.0dp6, but packages for the most recent builds are available through the snapshot repository. \u00a0More on that at the end.<\/p>\n<p>You could print out the all possible sub-commands using the <code>help<\/code>subcommand:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc help<br \/>\nUsage: cbc command [options]<br \/>\ncommand may be:<br \/>\nhelp \u00a0 \u00a0 \u00a0 show this help or for given command<br \/>\ncat \u00a0 \u00a0 \u00a0 \u00a0output keys to stdout<br \/>\ncp \u00a0 \u00a0 \u00a0 \u00a0 store files to the cluster<br \/>\ncreate \u00a0 \u00a0 store files with options<br \/>\nflush \u00a0 \u00a0 \u00a0remove all keys from the cluster<br \/>\nhash \u00a0 \u00a0 \u00a0 hash key(s) and print out useful info<br \/>\nlock \u00a0 \u00a0 \u00a0 lock keys<br \/>\nunlock \u00a0 \u00a0 unlock keys<br \/>\nrm \u00a0 \u00a0 \u00a0 \u00a0 remove keys<br \/>\nstats \u00a0 \u00a0 \u00a0show stats<br \/>\nverify \u00a0 \u00a0 verify content in cache with files<br \/>\nversion \u00a0 \u00a0show version<br \/>\nUse &#8216;cbc command &#8211;help&#8217; to show the options<\/div>\n<\/div>\n<p>The &#8220;help&#8221;\u00a0command accepts the command name as an argument and shows the command&#8217;s short description and all options the command can process, e.g. <code>cbc help cp<\/code>.<\/p>\n<p>This command was added recently and may not be available in all versions. It is still possible to get list of commands in any version you have installed: just execute <code>cbc<\/code>without arguments and &#8220;cbc cp &#8211;help&#8221; correspondingly.<\/p>\n<p>All commands are accessible either as subcommands or symlinks to the main binary, e.g. &#8220;cbc cp&#8221;\u00a0and &#8220;cbc-cp&#8221;. The latter form is useful in shell scripts.<\/p>\n<h3>Connecting to Cluster<\/h3>\n<p>All commands accept a common set of arguments like <code>--host<\/code>, <code>--bucket<\/code>, <code>--user<\/code>, <code>--password<\/code>, and <code>--timeout<\/code>. These arguments should be specified to every command which requires interaction with cluster which need special connection options, like bucket name or authorization.<\/p>\n<p>The option <code>--enable-timings<\/code>will set make cbc record timings for all operations and output then to STDERR.<\/p>\n<p>By default it will use <code>localhost<\/code>for <code>--host<\/code>, <code>default<\/code>for <code>--bucket<\/code>, nothing for <code>--user<\/code>\/<code>--password<\/code>, and finally <code>2500000<\/code>microseconds for <code>--timeout<\/code>.<\/p>\n<p>If your connection settings are not the defaults, but you still doesn\u2019t like typing them each time, we have solution: just put all of the settings into a file at <code>$HOME\/.cbcrc<\/code>and all libcouchbase tools will use this before starting. The format is pretty simple: all empty lines and lines starting with <code>#<\/code>are skipped. Here&#8217;s my example config:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\"># this config changes connection defaults and sets the timeout to 3 seconds<br \/>\nuri=example.com:8091,example.org:8091<br \/>\nuser=Administrator<br \/>\npassword=s3cr3t<br \/>\nbucket=mybucket<br \/>\ntimeout=3000000<\/div>\n<\/div>\n<p>There is also a way to override the <code>.cbcrc<\/code>values but honour command line arguments: set environment variables. Couchbase cbc tools look at the following variables at startup: <code>COUCHBASE_CLUSTER_URI<\/code>, <code>COUCHBASE_CLUSTER_USER<\/code>, <code>COUCHBASE_CLUSTER_PASSWORD<\/code>, <code>COUCHBASE_CLUSTER_BUCKET<\/code>.<\/p>\n<h3><code>cbc-cp<\/code>cbc-cp: Copy File(s) to the Cluster<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help cp<br \/>\nUsage: cp [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command copies file contents to the given cluster using filename for the key. For example the following command will store contents of the JSON file <code>buzz.json<\/code>:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc cp buzz.json<br \/>\nStored &#8220;buzz.json&#8221; CAS:66f09fa920d0000<\/div>\n<\/div>\n<p>After storing you will see the status on standard error. The command <code>cbc-cp<\/code>uses the file name as the key name and file contents as a value. It is possible to store several files quickly, as the command will pipeline the operations:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc cp buzz.json barbie.json<br \/>\nStored &#8220;buzz.json&#8221; CAS:6c55a2eae30d0000<br \/>\nStored &#8220;barbie.json&#8221; CAS:bdf8a2eae30d0000<\/div>\n<\/div>\n<p>The command can also read file list from STDIN. For example you can feed output of the <code>ls<\/code>command to <code>cbc cp<\/code>(note that filenames must be separated with a newline char):<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ ls *.json | cbc cp &#8211;<br \/>\nStored &#8220;barbie.json&#8221; CAS:8eb154e522020000<br \/>\nStored &#8220;buzz.json&#8221; CAS:95a67ee922020000<\/div>\n<\/div>\n<h3><code>cbc-create<\/code>: Create Keys with Specific Options<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help create<br \/>\nUsage: create [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<br \/>\n-f val \u00a0Flag for the new object (&#8211;flag)<br \/>\n-e val \u00a0Expiry time for the new object (&#8211;exptime)<br \/>\n-a \u00a0 \u00a0 \u00a0Fail if the object exists (&#8211;add)<\/p>\n<\/div>\n<\/div>\n<p>This command creates the item in the cluster with the given options, like expiration time (<code>--exptime<\/code>), flags (<code>--flag<\/code>) or force it to use ADD command (<code>--add<\/code>) which will fail if the key already in the cluster. The command operates on a single key only and then waits for the value on STDIN (type a <code>^D<\/code>to insert the required EOF). For example:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc create -f 3735928559 hello<br \/>\nHello, Couchbase!<br \/>\nStored &#8220;hello&#8221; CAS:b79b729f70070000<\/div>\n<\/div>\n<h3><code>cbc-cat<\/code>: Print Keys to STDOUT<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help cat<br \/>\nUsage: cat [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command simply writes the contents of the all keys to STDOUT like Unix command <code>cat(1)<\/code>. Also it writes useful info to STDERR. For example, lets output the key <code>hello<\/code>set above:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc cat hello<br \/>\n&#8220;hello&#8221; Size 18 Flags:deadbeef CAS:853dcf95bc070000<br \/>\nHello, Couchbase!<\/div>\n<\/div>\n<h3>cbc-rm: Remove Key<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help rm<br \/>\nUsage: rm [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command removes given key from the cluster:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc rm hello<br \/>\nRemoved &#8220;hello&#8221;<\/div>\n<\/div>\n<h3><code>cbc-hash<\/code>: Perform Hash Calculation<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help hash<br \/>\nUsage: hash [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command calculates the hash value of the key and locate the server which should store it, using the current cluster config. It also writes useful info about what vbucket is responsible for key, what the address is for that vbucket, the endpoint for requests for Couchbase Views and the list of replica nodes.<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc hash foo bar baz<br \/>\n&#8220;foo&#8221; \u00a0 vBucket: 115, Server: &#8220;172.16.16.193:12000&#8221;, Couch API: &#8220;https:\/\/172.16.16.193:9500\/default&#8221;, Replicas: &#8220;127.0.0.1:11210&#8221;, &#8220;172.16.16.193:12000&#8221;, &#8220;172.16.16.193:12003&#8221;<br \/>\n&#8220;bar&#8221; \u00a0 vBucket: 767, Server: &#8220;172.16.16.193:12009&#8221;, Couch API: &#8220;https:\/\/172.16.16.193:9503\/default&#8221;, Replicas: &#8220;127.0.0.1:11210&#8221;, &#8220;172.16.16.193:12000&#8221;, &#8220;172.16.16.193:12003&#8221;<br \/>\n&#8220;baz&#8221; \u00a0 vBucket: 36, Server: &#8220;172.16.16.193:12000&#8221;, Couch API: &#8220;https:\/\/172.16.16.193:9500\/default&#8221;, Replicas: &#8220;127.0.0.1:11210&#8221;, &#8220;172.16.16.193:12000&#8221;, &#8220;172.16.16.193:12003&#8221;<\/div>\n<\/div>\n<h3><code>cbc-stats<\/code>: Dump Cluster Statistics<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help stats<br \/>\nUsage: stats [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command returns tab-separated tuples of the server statistics. First is the node hostname with port, then stat key and stat value.<\/p>\n<p>To show a simple scripting example, this is how you can calculate used memory on the whole cluster (this cluster has 5 nodes):<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc stats \u00a0| awk &#8216;\/mem_used\/ { print($1 &#8220;: &#8221; $3); sum += $3 } END {print(&#8220;total: &#8221; sum)}&#8217;<br \/>\n192.168.1.3:12000: 20369582<br \/>\n192.168.1.3:12003: 22086752<br \/>\n192.168.1.3:12006: 21664064<br \/>\n127.0.0.1:11210: 27053336<br \/>\n192.168.1.3:12009: 22086752<br \/>\ntotal: 113260486<\/div>\n<\/div>\n<p>The stats output contains not only statistics from the live cluster but also its configuration parameters. You can get the maximum and default time (in seconds) for key locks (which we&#8217;ll want to know soon):<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc stats | grep getl<br \/>\n127.0.0.1:11210 ep_getl_default_timeout 15<br \/>\n127.0.0.1:11210 ep_getl_max_timeout \u00a0 \u00a0 30<br \/>\n192.168.1.3:12000 \u00a0 \u00a0 \u00a0 ep_getl_default_timeout 15<br \/>\n192.168.1.3:12000 \u00a0 \u00a0 \u00a0 ep_getl_max_timeout \u00a0 \u00a0 30<br \/>\n192.168.1.3:12003 \u00a0 \u00a0 \u00a0 ep_getl_default_timeout 15<br \/>\n192.168.1.3:12003 \u00a0 \u00a0 \u00a0 ep_getl_max_timeout \u00a0 \u00a0 30<br \/>\n192.168.1.3:12009 \u00a0 \u00a0 \u00a0 ep_getl_default_timeout 15<br \/>\n192.168.1.3:12009 \u00a0 \u00a0 \u00a0 ep_getl_max_timeout \u00a0 \u00a0 30<br \/>\n192.168.1.3:12006 \u00a0 \u00a0 \u00a0 ep_getl_default_timeout 15<br \/>\n192.168.1.3:12006 \u00a0 \u00a0 \u00a0 ep_getl_max_timeout \u00a0 \u00a0 30<\/div>\n<\/div>\n<h3><code>cbc-lock<\/code>: Lock Key<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help lock<br \/>\nUsage: lock [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<br \/>\n-e val \u00a0Expiry time for the lock (&#8211;exptime)<\/p>\n<\/div>\n<\/div>\n<p>This command locks the specified keys, making all mutation requests generate an error. It allows you to specify the expiration time (&#8220;&#8211;exptime&#8221;). You can inspect cluster default and maximum timeouts with the &#8220;cbc-stats&#8221;\u00a0command as described above.<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc create hello<br \/>\nHi<br \/>\nStored &#8220;hello&#8221; CAS:57fa8b8c01020000<br \/>\n$ cbc rm hello<br \/>\nFailed to remove &#8220;hello&#8221;:<br \/>\nInvalid arguments<br \/>\n$ sleep 20<br \/>\n$ cbc rm hello<br \/>\nRemoved &#8220;hello&#8221;<\/div>\n<\/div>\n<p>The <code>cbc-lock<\/code>command allows multiple keys.<\/p>\n<h3><code>cbc-unlock<\/code>: Unlock Key<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help unlock<br \/>\nUsage: unlock [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command unlocks given keys. It accepts pairs of key and CAS values. \u00a0If they match, the server releases the lock.<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc lock -e 30 *.json &gt; \/dev\/null<br \/>\n&#8220;barbie.json&#8221; Size:139 Flags:0 CAS:900ccb8ea2030000<br \/>\n&#8220;buzz.json&#8221; Size:93 Flags:0 CAS:e79acb8ea2030000<br \/>\n$ cbc unlock barbie.json 900ccb8ea2030000 buzz.json e79acb8ea2030000<br \/>\nUnlocked &#8220;barbie.json&#8221;<br \/>\nUnlocked &#8220;buzz.json&#8221;<\/div>\n<\/div>\n<h3><code>cbc-verify<\/code>: Verify Keys<\/h3>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">\n<p>$ cbc help verify<br \/>\nUsage: verify [options] [arguments]<\/p>\n<p>-? \u00a0 \u00a0 \u00a0Print this help text (&#8211;help)<br \/>\n-h val \u00a0Hostname to connect to (&#8211;host)<br \/>\n-b val \u00a0Bucket to use (&#8211;bucket)<br \/>\n-u val \u00a0Username for the rest port (&#8211;user)<br \/>\n-P val \u00a0password for the rest port (&#8211;password)<br \/>\n-T \u00a0 \u00a0 \u00a0Enable command timings (&#8211;enable-timings)<br \/>\n-t val \u00a0Specify timeout value (&#8211;timeout)<\/p>\n<\/div>\n<\/div>\n<p>This command verify the keys&#8217; consistency. It compares the contents of the keys with corresponding files. If all is ok, it just return zero code at exit and prints nothing. So more interesting the case when something wrong. Let\u2019s remove <code>buzz.json<\/code>and add something to <code>barbie.json<\/code>:<\/p>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace;\">$ cbc cp *.json<br \/>\nStored &#8220;barbie.json&#8221; CAS:59c1a52165050000<br \/>\nStored &#8220;buzz.json&#8221; CAS:e17da62165050000<br \/>\n$ cbc rm buzz.json<br \/>\nRemoved &#8220;buzz.json&#8221;<br \/>\n$ echo &#8220;garbage&#8221; &gt;&gt; barbie.json<br \/>\n$ cbc verify *.json<br \/>\nIncorrect size for: &#8220;barbie.json&#8221;<br \/>\nFailed to get &#8220;buzz.json&#8221;: No such key<br \/>\n$ echo $?<br \/>\n1<\/div>\n<\/div>\n<div><\/div>\n<div>As you can see, there are a number of pretty useful utilities in &#8220;cbc&#8221;. \u00a0In fine UNIX tradition, you can build upon them with your own scripts and logic. \u00a0Of course, it&#8217;s all Open Source as well, so feel free to have a look at the code and maybe contribute some new ideas over on <a href=\"https:\/\/github.com\/couchbase\/libcouchbase\">github<\/a>.<\/div>\n<div><\/div>\n<div>To get the very latest code right after it goes through <a href=\"https:\/\/review.couchbase.org\/#q,libcouchbase+status:open,n,z\">code review<\/a>, including everything you see in this blog as of this writing, add one of our <a href=\"https:\/\/www.couchbase.com\/wiki\/pages\/viewpage.action?pageId=12943548\">snapshot repositories<\/a> and update your libcouchbase package.<\/div>\n<div><\/div>\n<div>Thanks!<\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post, I will reveal some the less known features of the libcouchbase client library. It describes the libcouchbase tools which are collectively under\u00a0cbc, the command originally written by Trond Norbye. You probably won\u2019t use them for writing [&hellip;]<\/p>\n","protected":false},"author":25,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8995],"class_list":["post-1578","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Couchbase Tools shipped with the Couchbase C Client Library<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)\" \/>\n<meta property=\"og:description\" content=\"In this blog post, I will reveal some the less known features of the libcouchbase client library. It describes the libcouchbase tools which are collectively under\u00a0cbc, the command originally written by Trond Norbye. You probably won\u2019t use them for writing [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-16T19:25:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-10T18:43:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sergey Avseyev, SDK Engineer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@avsej\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sergey Avseyev, SDK Engineer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\"},\"author\":{\"name\":\"Sergey Avseyev, SDK Engineer, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e9181374f225c90084ec3ba86bdcfa2e\"},\"headline\":\"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)\",\"datePublished\":\"2014-12-16T19:25:42+00:00\",\"dateModified\":\"2020-09-10T18:43:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\"},\"wordCount\":1946,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\",\"name\":\"Couchbase Tools shipped with the Couchbase C Client Library\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-16T19:25:42+00:00\",\"dateModified\":\"2020-09-10T18:43:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e9181374f225c90084ec3ba86bdcfa2e\",\"name\":\"Sergey Avseyev, SDK Engineer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/796ab283bd56fe3716a102ebe16daff6\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/288a892d231cf8c4e57ed0643e4681b4654a141361f6ec3c5b79ccd4d885e038?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/288a892d231cf8c4e57ed0643e4681b4654a141361f6ec3c5b79ccd4d885e038?s=96&d=mm&r=g\",\"caption\":\"Sergey Avseyev, SDK Engineer, Couchbase\"},\"description\":\"Sergey Avseyev is a SDK Engineer at Couchbase. Sergey Avseyev is responsible for development of Kafka connector, and underlying library, which implements DCP, Couchbase replication protocol. Also maintaining PHP SDK for Couchbase.\",\"sameAs\":[\"https:\/\/x.com\/avsej\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/sergey-avseyev\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Couchbase Tools shipped with the Couchbase C Client Library","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/","og_locale":"en_US","og_type":"article","og_title":"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)","og_description":"In this blog post, I will reveal some the less known features of the libcouchbase client library. It describes the libcouchbase tools which are collectively under\u00a0cbc, the command originally written by Trond Norbye. You probably won\u2019t use them for writing [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-16T19:25:42+00:00","article_modified_time":"2020-09-10T18:43:39+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"Sergey Avseyev, SDK Engineer, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@avsej","twitter_misc":{"Written by":"Sergey Avseyev, SDK Engineer, Couchbase","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/"},"author":{"name":"Sergey Avseyev, SDK Engineer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e9181374f225c90084ec3ba86bdcfa2e"},"headline":"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)","datePublished":"2014-12-16T19:25:42+00:00","dateModified":"2020-09-10T18:43:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/"},"wordCount":1946,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/","name":"Couchbase Tools shipped with the Couchbase C Client Library","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-16T19:25:42+00:00","dateModified":"2020-09-10T18:43:39+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-tools-shipped-couchbase-c-client-library-libcouchbase\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Couchbase Tools shipped with the Couchbase C Client Library (libcouchbase)"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e9181374f225c90084ec3ba86bdcfa2e","name":"Sergey Avseyev, SDK Engineer, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/796ab283bd56fe3716a102ebe16daff6","url":"https:\/\/secure.gravatar.com\/avatar\/288a892d231cf8c4e57ed0643e4681b4654a141361f6ec3c5b79ccd4d885e038?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/288a892d231cf8c4e57ed0643e4681b4654a141361f6ec3c5b79ccd4d885e038?s=96&d=mm&r=g","caption":"Sergey Avseyev, SDK Engineer, Couchbase"},"description":"Sergey Avseyev is a SDK Engineer at Couchbase. Sergey Avseyev is responsible for development of Kafka connector, and underlying library, which implements DCP, Couchbase replication protocol. Also maintaining PHP SDK for Couchbase.","sameAs":["https:\/\/x.com\/avsej"],"url":"https:\/\/www.couchbase.com\/blog\/author\/sergey-avseyev\/"}]}},"authors":[{"term_id":8995,"user_id":25,"is_guest":0,"slug":"sergey-avseyev","display_name":"Sergey Avseyev, SDK Engineer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/288a892d231cf8c4e57ed0643e4681b4654a141361f6ec3c5b79ccd4d885e038?s=96&d=mm&r=g","author_category":"","last_name":"Avseyev, SDK Engineer, Couchbase","first_name":"Sergey","job_title":"","user_url":"","description":"Sergey Avseyev is a SDK Engineer at Couchbase. Sergey Avseyev is responsible for development of Kafka connector, and underlying library, which implements DCP, Couchbase replication protocol. Also maintaining PHP SDK for Couchbase."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1578","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/25"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=1578"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/1578\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=1578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=1578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=1578"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=1578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}