1CBC(1)                                                                  CBC(1)
2
3
4

NAME

6       cbc - Couchbase Client Commandline Utility
7

SYNOPSIS

9       cbc COMMAND [OPTIONS]
10       cbc help
11       cbc version
12       cbc cat KEYS ... [OPTIONS]
13       cbc create KEY -V VALUE [OPTIONS]
14       cbc create KEY [OPTIONS]
15       cbc cp FILES ... [OPTIONS]
16       cbc incr KEY [OPTIONS]
17       cbc decr KEY [OPTIONS]
18       cbc touch KEY [OPTIONS]
19       cbc rm KEY [OPTIONS]
20       cbc hash KEY [OPTIONS]
21       cbc stats KEYS ... [OPTIONS]
22       cbc observe KEYS ... [OPTIONS]
23       cbc view VIEWPATH [OPTIONS]
24       cbc lock KEY [OPTIONS]
25       cbc unlock KEY CAS [OPTIONS]
26       cbc admin -P PASSWORD RESTAPI [OPTIONS]
27       cbc bucket-create -P PASSWORD NAME [OPTIONS]
28       cbc bucket-delete -P PASSWORD NAME [OPTIONS]
29       cbc bucket-flush NAME [OPTIONS]
30       cbc role-list [OPTIONS]
31       cbc user-list [OPTIONS]
32       cbc user-upsert NAME [OPTIONS]
33       cbc user-delete NAME [OPTIONS]
34       cbc connstr SPEC
35       cbc query QUERY ... [OPTIONS]
36       cbc write-config [OPTIONS ...]
37       cbc strerror HEX-OR-DECIMAL-CODE
38       cbc ping [OPTIONS ...]
39       cbc watch [KEYS ...] [OPTIONS ...]
40       cbc keygen [KEYS ...] [OPTIONS ...]
41

DESCRIPTION

43       cbc is a utility for communicating with a Couchbase cluster.
44
45       cbc  should be invoked with the command name first and then a series of
46       command options appropriate for the specific command. cbc help will al‐
47       ways show the full list of available commands.
48

OPTIONS

50       Options  may be read either from the command line, or from a configura‐
51       tion file (see cbcrc(4)):
52
53       The following common options may be applied to most of the commands
54
55       -U, --spec=SPEC
56              A string describing the cluster to connect to. The string is  in
57              a  URI-like  syntax, and may also contain other options. See the
58              EXAMPLES section for information. Typically such a URI will look
59              like couchbase://host1,host2,host3/bucket.
60
61              The default for this option is couchbase://localhost/default
62
63       -u, --username=USERNAME
64              Specify the username for the bucket. Since Couchbase 5.x this is
65              mandatory switch, and it must specify the name of the  user  ex‐
66              isiting  on  cluster (read more at "Security/Authorization" sec‐
67              tion of the server manual). For older servers this field  should
68              be either left empty or set to the name of the bucket itself.
69
70       -P, --password=PASSWORD:
71
72
73       -P -, --password=-
74              Specify  the  password for the bucket. As for servers before 5.x
75              this was only needed if the bucket is protected with a password.
76              For  cluster  version  after 5.x, the password is mandatory, and
77              should match the selected account (read more at "Security/Autho‐
78              rization" section of the server manual).
79
80              Specifying  the  -  as  the  password indicates that the program
81              should prompt for the password. You may also specify  the  pass‐
82              word  on  the  commandline, directly, but is insecure as command
83              line arguments are visible via commands such as ps.
84
85       -T, --timings
86              Dump command timings at the end of execution. This will  display
87              a histogram showing the latencies for the commands executed.
88
89       -v, --verbose
90              Specify more information to standard error about what the client
91              is doing. You may specify this option  multiple  times  for  in‐
92              creased output detail.
93
94       -D, --cparam=OPTION=VALUE
95              Provide  additional  client options. Acceptable options can also
96              be placed in the connection string, however this option is  pro‐
97              vided  as  a  convenience. This option may be specified multiple
98              times, each time specifying a key=value pair (for example, -Dop‐
99              eration_timeout=10  -Dconfig_cache=/foo/bar/baz). See ADDITIONAL
100              OPTIONS for more information
101
102       -y, --compress
103              Enable compressing of documents. When the  library  is  compiled
104              with  compression  support,  this option will enable Snappy com‐
105              pression for outgoing data. Incoming compressed data handled au‐
106              tomatically  regardless  of  this option. Note, that because the
107              compression support have to be negotiated with the server, first
108              packets  might  be  sent  uncompressed even when this switch was
109              specified. This is because the library might queue data commands
110              before  socket  connection has been established, and the library
111              will negotiate compression feature. If  it  is  known  that  all
112              server  support compression repeating the switch (like -yy) will
113              force compression for all outgoing mutations, even scheduled be‐
114              fore establishing connection.
115
116       --truststorepath=PATH
117              The  path to the server´s SSL certificate. This is typically re‐
118              quired for SSL connectivity unless the certificate  has  already
119              been  added  to the OpenSSL installation on the system (only ap‐
120              plicable with couchbases:// scheme)
121
122       --certpath=PATH
123              The path to the server´s SSL certificate. This is typically  re‐
124              quired  for  SSL connectivity unless the certificate has already
125              been added to the OpenSSL installation on the system  (only  ap‐
126              plicable  with  couchbases://  scheme). This also should contain
127              client certificate when certificate authentication used, and  in
128              this  case  other  public  certificates  could be extracted into
129              truststorepath chain.
130
131       --keypath=PATH
132              The path to the client SSL private key. This  is  typically  re‐
133              quired  for  SSL client certificate authentication. The certifi‐
134              cate itself have to go first  in  chain  specified  by  certpath
135              (only applicable with couchbases:// scheme)
136
137       --dump Dump verbose internal state after operations are done.
138

ADDITIONAL OPTIONS

140       The following options may be included in the connection string (via the
141       -U option) as URI-style query params (e.g.  couchbase://host/bucket?op‐
142       tion1=value1&option2=value2) or as individual key=value pairs passed to
143       the -D switch (e.g. -Doption1=value1 -Doption2=value). The -D will  in‐
144       ternally  build the connection string, and is provided as a convenience
145       for options to be easily passed on the command-line
146
147operation_timeout=SECONDS: Specify the operation  timeout  in  sec‐
148           onds.  This  is  the  time the client will wait for an operation to
149           complete before timing it out. The default is 2.5
150
151config_cache=PATH: Enables the client to make use of a  file  based
152           configuration cache rather than connecting for the bootstrap opera‐
153           tion. If the file does not exist, the client will first connect  to
154           the cluster and then cache the bootstrap information in the file.
155
156truststorepath=PATH: The path to the server´s SSL certificate. This
157           is typically required for SSL connectivity unless  the  certificate
158           has  already  been  added to the OpenSSL installation on the system
159           (only applicable with couchbases:// scheme)
160
161certpath=PATH: The path to the server´s SSL  certificate.  This  is
162           typically  required for SSL connectivity unless the certificate has
163           already been added to the OpenSSL installation on the system  (only
164           applicable  with  couchbases://  scheme).  This also should contain
165           client certificate when certificate  authentication  used,  and  in
166           this  case other public certificates could be extracted into trust‐
167           storepath chain.
168
169keypath=PATH: The path to the client SSL private key. This is typi‐
170           cally  required for SSL client certificate authentication. The cer‐
171           tificate itself have to go first in  chain  specified  by  certpath
172           (only applicable with couchbases:// scheme)
173
174ipv6=allow: Enable IPv6.
175
176ssl=no_verify: Temporarily disable certificate verification for SSL
177           (only applicable with couchbases:// scheme). This  should  only  be
178           used for quickly debugging SSL functionality.
179
180sasl_mech_force=MECHANISM:  Force  a  specific SASL mechanism to be
181           used when performing the initial connection. This should only  need
182           to  be  modified  for  debugging  purposes. The currently supported
183           mechanisms are PLAIN and CRAM-MD5
184
185bootstrap_on=<both,http,cccp>: Specify the bootstrap  protocol  the
186           client  should  use  when attempting to connect to the cluster. Op‐
187           tions are: cccp: Bootstrap using the Memcached protocol  (supported
188           on  clusters  2.5 and greater); http: Bootstrap using the HTTP REST
189           protocol (supported on any cluster version); and  both:  First  at‐
190           tempt  bootstrap over the Memcached protocol, and use the HTTP pro‐
191           tocol if Memcached bootstrap fails. The default is both
192
193enable_tracing=true/false: Activate/deactivate end-to-end tracing.
194
195tracing_orphaned_queue_flush_interval=SECONDS: Flush  interval  for
196           orphaned spans queue in default tracer. This is the time the tracer
197           will wait between repeated attempts to flush most  recent  orphaned
198           spans. Default value is 10 seconds.
199
200tracing_orphaned_queue_size=NUMBER: Size of orphaned spans queue in
201           default tracer. Queues in default tracer has  fixed  size,  and  it
202           will  remove  information about older spans, when the limit will be
203           reached before flushing time. Default value is 128.
204
205tracing_threshold_queue_flush_interval=SECONDS: Flush interval  for
206           spans with total time over threshold in default tracer. This is the
207           time the tracer  will  wait  between  repeated  attempts  to  flush
208           threshold queue. Default value is 10 seconds.
209
210tracing_threshold_queue_size=NUMBER: Size of threshold queue in de‐
211           fault tracer. Queues in default tracer has fixed size, and it  will
212           remove  information  about  older  spans,  when  the  limit will be
213           reached before flushing time. Default value is 128.
214
215tracing_threshold_kv=SECONDS: Minimum time for the tracing span  of
216           KV  service  to be considered by threshold tracer. Default value is
217           0.5 seconds.
218
219tracing_threshold_query=SECONDS: Minimum time for the tracing  span
220           of  QUERY  service  to  be  considered by threshold tracer. Default
221           value is 1 second.
222
223tracing_threshold_view=SECONDS: Minimum time for the  tracing  span
224           of VIEW service to be considered by threshold tracer. Default value
225           is 1 second.
226
227tracing_threshold_search=SECONDS: Minimum time for the tracing span
228           of  SEARCH  service  to  be considered by threshold tracer. Default
229           value is 1 second.
230
231tracing_threshold_analytics=SECONDS: Minimum time for  the  tracing
232           span of ANALYTICS service to be considered by threshold tracer. De‐
233           fault value is 1 second.
234
235
236

COMMANDS

238       The following commands are supported by cbc.  Unless  otherwise  speci‐
239       fied, each command supports all of the options above.
240
241   cat
242       Write the value of keys to standard output.
243
244       This  command  requires  that at least one key may be passed to it, but
245       may accept multiple keys. The keys should be  specified  as  positional
246       arguments after the command.
247
248       In  addition  to  the options in the OPTIONS section, the following op‐
249       tions are supported:
250
251       r, --replica=all|INDEX
252              Read the value from a replica server. The value for this  option
253              can  either be the string all which will cause the client to re‐
254              quest the value from each replica, or INDEX  where  INDEX  is  a
255              0-based replica index.
256
257       e, --expiry=EXPIRATION
258              Specify  that this operation should be a get-and-touch operation
259              in which the key´s expiry time is updated along with  retrieving
260              the item.
261
262   create
263   cp
264       Create  a  new  item in the cluster, or update the value of an existing
265       item. By default this command will read the value from  standard  input
266       unless the --value option is specified.
267
268       The  cp  command  functions  the  same, except it operates on a list of
269       files. Each file is stored in the cluster under the name  specified  on
270       the command line.
271
272       In  addition  to  the options in the OPTIONS section, the following op‐
273       tions are supported:
274
275       -V, --value=VALUE
276              The value to store in the cluster. If omitted, the value is read
277              from  standard  input.  This option is valid only for the create
278              command.
279
280       f, --flags=ITEMFLAGS
281              A 32 bit unsigned integer to be stored alongside the value. This
282              number  is  returned  when  the  item  is retrieved again. Other
283              clients commonly use this value to determine the  type  of  item
284              being stored.
285
286       e, --expiry=EXPIRATION
287              The  number of time in seconds from now at which the item should
288              expire.
289
290       M, --mode=upsert|insert|replace
291              Specify the storage mode. Mode can be one of insert (store  item
292              if  it  does not yet exist), replace (only store item if key al‐
293              ready exists), or upsert (unconditionally store item)
294
295       d, --durability=LEVEL
296              Specify durability level for mutation operations.  Known  values
297              are: "none", "majority", "majority_and_persist_to_active", "per‐
298              sist_to_majority".
299
300       p, --persist-to=NUMNODES
301              Wait until the item has been  persisted  to  at  least  NUMNODES
302              nodes´  disk.  If  NUMNODES is 1 then wait until only the master
303              node has persisted the item for this key. You may not specify  a
304              number greater than the number of nodes actually in the cluster.
305
306       r --replicate-to=NREPLICAS
307              Wait  until  the  item has been replicated to at least NREPLICAS
308              replica nodes. The bucket must be configured with at  least  one
309              replica, and at least NREPLICAS replica nodes must be online.
310
311   observe
312       Retrieve persistence and replication information for items.
313
314       This command will print the status of each key to standard error.
315
316       See the OPTIONS for accepted options
317
318   incr
319   decr
320       These  commands increment or decrement a counter item in the cluster. A
321       counter is a value stored as an ASCII string which  is  readable  as  a
322       number, thus for example 42.
323
324       These  commands will by default refuse to operate on an item which does
325       not exist in the cluster.
326
327       The incr and decr command differ with how they treat the --delta  argu‐
328       ment.  The  incr  command will treat the value as a positive offset and
329       increment the current value by the amount specified, whereas  the  decr
330       command  will  treat  the  value as a negative offset and decrement the
331       value by the amount specified.
332
333       In addition to OPTIONS, the following options are supported:
334
335       --initial=_DEFAULT_
336              Set the initial value for the item if it does not exist  in  the
337              cluster. The value should be an unsigned 64 bit integer. If this
338              option is not specified and the item does not exist, the  opera‐
339              tion will fail. If the item does exist, this option is ignored.
340
341       --delta=DELTA
342              Set  the absolute delta by which the value should change. If the
343              command is incr then the  value  will  be  incremented  by  this
344              amount.  If  the  command  is decr then the value will be decre‐
345              mented by this amount. The default value for this option is 1.
346
347       -e, --expiry=EXPIRATION
348              Set the expiration time for the key, in terms  of  seconds  from
349              now.
350
351   hash
352       Display mapping information for a key.
353
354       This  command  diplays mapping information about a key. The mapping in‐
355       formation indicates which vBucket the  key  is  mapped  to,  and  which
356       server is currently the master node for the given vBucket.
357
358       See the OPTIONS for accepted options
359
360   lock
361       Lock an item in the cluster.
362
363       This  will retrieve and lock an item in the cluster, making it inacces‐
364       sible for modification until it is unlocked (see unlock).
365
366       In addition to the common options (OPTIONS), this command  accepts  the
367       following options:
368
369       e, --expiry=LOCKTIME
370              Specify  the  amount of time the lock should be held for. If not
371              specified, it will default to the server side maximum of 15 sec‐
372              onds.
373
374   unlock
375       Unlock a previously locked item.
376
377       This  command  accepts two mandatory positional arguments which are the
378       key and CAS value. The CAS value should be specified  as  printed  from
379       the lock command (i.e. with the leading 0x hexadecimal prefix).
380
381       See the OPTIONS for accepted options
382
383   rm
384       Remove an item from the cluster.
385
386       This command will remove an item from the cluster. If the item does not
387       exist, the operation will fail.
388
389       See the OPTIONS for accepted options
390
391   stats
392       Retrieve a list of cluster  statistics.  If  positional  arguments  are
393       passed to this command, only the statistics classified under those keys
394       will be retrieved. See the server documentation for a full list of pos‐
395       sible statistics categories.
396
397       This  command will contact each server in the cluster and retrieve that
398       node´s own set of statistics.
399
400       The statistics are printed to standard output in  the  form  of  SERVER
401       STATISTIC  VALUE  where  SERVER  is the host:port representation of the
402       node from which has provided this statistic, STATISTIC is the  name  of
403       the current statistical key, and VALUE is the value for this statistic.
404
405       See the OPTIONS for accepted options
406
407   watch
408       Retrieve  a  list  of cluster statistics, select specified sub-keys and
409       aggregate values across the cluster. Then continuously poll  the  stats
410       and  display  the  difference  with the previous values. If the list of
411       stat sub-keys  not  specified,  the  command  will  use  cmd_total_ops,
412       cmd_total_gets, cmd_total_sets.
413
414       In  addition  to  the options in the OPTIONS section, the following op‐
415       tions are supported: * -n, --interval=VALUE: Update interval in seconds
416       (default 1 second).
417
418   keygen
419       Output list of keys that equally distribute amongst every vbucket.
420
421       In  addition  to  the options in the OPTIONS section, the following op‐
422       tions are supported: * --keys-per-vbucket=VALUE: Number of keys to gen‐
423       erate per vBucket (default 1).
424
425   write-config
426       Write the configuration file based on arguments passed.
427
428   strerror
429       Decode library error code
430
431   version
432       Display  information  about  the  underlying version of libcouchbase to
433       which the cbc binary is linked.
434
435   verbosity
436       Set the memcached logging versbosity on the cluster. This  affects  how
437       the memcached processes write their logs. This command accepts a single
438       positional argument which is a string describing the verbosity level to
439       be set. The options are detail, debug info, and warning.
440
441   ping
442       Sends  NOOP-like request to every service on each cluster node, and re‐
443       port time it took to response.
444
445       --details
446              Provide more details about status of the service.
447
448   view
449       Execute an HTTP request against the server´s view (CAPI) interface.
450
451       The request may be one to create a design document, view a design docu‐
452       ment, or query a view.
453
454       To  create  a design document, the definition of the document (in JSON)
455       should be piped to the command on standard input.
456
457       This command accepts one positional argument which is the  path  (rela‐
458       tive to the bucket) to execute. Thus to query the brewery_beers view in
459       the beer design document within the beer-sample bucket  one  would  do:
460       cbc  view  -U  couchbase://localhost/beer-sample design/beer/view/brew‐
461       ery_beers
462
463       In addition to the OPTIONS specified above, the following  options  are
464       recognized:
465
466       -X, --method=GET|PUT|POST|DELETE
467              Specify the HTTP method to use for the specific request. The de‐
468              fault method is GET to query a view. To delete an  existing  de‐
469              sign  document, specify DELETE, and to create a new design docu‐
470              ment, specify PUT.
471
472   query
473       Execute a N1QL Query. The cluster must have at least one query node en‐
474       abled.
475
476       The query itself is passed as a positional argument on the commandline.
477       The query may contain named placeholders (in  the  format  of  $param),
478       whose  values  may be supplied later on using the --qarg=´$param=value´
479       syntax.
480
481       It is recommended to place the statement  in  single  quotes  to  avoid
482       shell expansion.
483
484       In  addition  to the OPTIONS specified above, the following options are
485       recognized:
486
487       -Q, --qopt=SETTING=VALUE
488              Specify additional options  controlling  the  execution  of  the
489              query. This can be used for example, to set the scan_consistency
490              of the query.
491
492       -A, --qarg=PLACEHOLDER=VALUE
493              Supply values for placeholders found in the  query  string.  The
494              placeholders must evaluate to valid JSON values.
495
496       --prepare
497              Prepare query before issuing. Default is FALSE.
498
499       --analytics
500              Perform query to analytics service. Default is FALSE.
501
502   admin
503       Execute an administrative request against the management REST API. Note
504       that in order to perform an administrative API you will need to provide
505       administrative  credentials  to  cbc admin. This means the username and
506       password used to log into the administration console.
507
508       This command accepts a single positional argument which is the REST API
509       endpoint (i.e. HTTP path) to execute.
510
511       If  the request requires a body, it should be supplied via standard in‐
512       put
513
514       In addition to the OPTIONS specified above, the following  options  are
515       recognized:
516
517       -X, --method=GET|PUT|POST|DELETE
518              Specify the HTTP method to use for the specific request. The de‐
519              fault method is GET.
520
521   bucket-create
522       Create a bucket in the cluster.
523
524       This command will create a bucket with the name specified as  the  lone
525       positional argument on the command line.
526
527       As this is an administrative command, the --username and --password op‐
528       tions should be supplied administrative credentials.
529
530       In addition to the OPTIONS specified above, the following  options  are
531       recognized:
532
533       --bucket-type=couchbase|memcached
534              Specify  the  type  of  bucket to create. A couchbase bucket has
535              persistence to  disk  and  replication.  A  memached  bucket  is
536              in-memory only and does not replicate.
537
538       --ram-quota=QUOTA
539              Specify  the  maximum  amount of memory the bucket should occupy
540              (per node) in megabytes. If not specified, the default is 512.
541
542       --bucket-password=PASSWORD
543              Specify the password to secure  this  bucket.  If  passed,  this
544              password  will  be required by all clients attempting to connect
545              to the bucket. If ommitted, this bucket may be accessible to ev‐
546              eryone for both read and write access.
547
548       --num-replicas=REPLICAS
549              Specify the amount of replicas the bucket should have. This will
550              set the number of nodes each item will be replicated to. If  not
551              specified the default is 1.
552
553   bucket-flush
554       This  command will flush the bucket with the name specified as the lone
555       positional argument on the command line.
556
557       This command does not require administrative level credentials, however
558       it does require that flush be enabled for the bucket.
559
560       See the OPTIONS for accepted options
561
562   role-list
563       List accessible RBAC user roles in the cluster.
564
565       In  addition  to the OPTIONS specified above, the following options are
566       recognized:
567
568       -r, --raw
569              Print unformatted server response in JSON form.
570
571   user-list
572       List users in the cluster.
573
574       In addition to the OPTIONS specified above, the following  options  are
575       recognized:
576
577       -r, --raw
578              Print unformatted server response in JSON form.
579
580   user-upsert
581       Create or update a user in the cluster. Takes user ID as an argument.
582
583       In  addition  to the OPTIONS specified above, the following options are
584       recognized:
585
586       --domain=local|remote
587              The domain, where user account defined. If  not  specified,  the
588              default is local.
589
590       --full-name=FULL_NAME
591              The  user´s  fullname.  If  not  specified, the default is empty
592              string.
593
594       --role=ROLE
595              The role associated with user (can be specified  multiple  times
596              if needed).
597
598       --user-password=PASSWORD
599              The password for the user.
600
601   user-delete
602       Delete a user in the cluster. Takes user ID as an argument.
603
604       In  addition  to the OPTIONS specified above, the following options are
605       recognized:
606
607       --domain=local|remote
608              The domain, where user account defined. If  not  specified,  the
609              default is local.
610
611   connstr
612       This  command will parse a connection string into its constituent parts
613       and display them on the screen. The command takes a  single  positional
614       argument which is the string to parse.
615

EXAMPLES

617   CONNECTION EXAMPLES
618       The  following  shows how to connect to various types of buckets. These
619       examples all show how to retrieve the key key. See  OPERATION  EXAMPLES
620       for more information on specific sub-commands.
621
622       Connect  to  a  bucket  (a_bucket)  on  a cluster on a remote host (for
623       servers version 5.x+). It uses account ´myname´ and asks  password  in‐
624       teractively:
625
626
627
628           cbc cat key -U couchbase://192.168.33.101/a_bucket -u myname -P-
629
630
631
632       Run  against a password-less bucket (a_bucket) on a cluster on a remote
633       host (for servers older than 5.x):
634
635
636
637           cbc cat key -U couchbase://192.168.33.101/a_bucket
638
639
640
641       Connect to an SSL cluster at secure.net. The certificate for the  clus‐
642       ter is stored locally at /home/couchbase/couchbase_cert.pem:
643
644
645
646           cbc cat key -U couchbases://secure.net/topsecret_bucket?certpath=/home/couchbase/couchbase_cert.pem
647
648
649
650       Connect to an SSL cluster at secure.net, ignoring certificate verifica‐
651       tion. This is insecure but handy for testing:
652
653
654
655           cbc cat key -U couchbases://secure.net/topsecret_bucket?ssl=no_verify
656
657
658
659       Connect to a password protected bucket (protected)  on  a  remote  host
660       (for servers older than 5.x):
661
662
663
664           cbc cat key -U couchbase://remote.host.net/protected -P-
665           Bucket password:
666
667
668
669       Connect  to  a  password protected bucket (for servers older than 5.x),
670       specifying the password on the command line (INSECURE, but  useful  for
671       testing dummy environments)
672
673
674
675           cbc cat key -U couchbase://remote.host.net/protected -P t0ps3cr3t
676
677
678
679       Connect to a bucket running on a cluster with a custom REST API port
680
681
682
683           cbc cat key -U http://localhost:9000/default
684
685
686
687       Connec to bucket running on a cluster with a custom memcached port
688
689
690
691           cbc cat key -U couchbase://localhost:12000/default
692
693
694
695       Connect  to a memcached (http://memcached.org) cluster using the binary
696       protocol. A vanilla memcached cluster is not the same  as  a  memcached
697       bucket residing within a couchbase cluster (use the normal couchbase://
698       scheme for that):
699
700
701
702           cbc cat key -U memcached://host1,host2,host3,host4
703
704
705
706       Connect to a cluster using the HTTP protocol for bootstrap, and set the
707       operation timeout to 5 seconds
708
709
710
711           cbc cat key -U couchbase://host/bucket -Dbootstrap_on=http -Doperation_timeout=5
712
713
714
715   OPERATION EXAMPLES
716       Store a file to the cluster:
717
718
719
720           $ cbc cp mystuff.txt
721           mystuff.txt         Stored. CAS=0xe15dbe22efc1e00
722
723
724
725       Retrieve  persistence/replication  information about an item (note that
726       Status is a set of bits):
727
728
729
730           $ cbc observe mystuff.txt
731           mystuff              [Master] Status=0x80, CAS=0x0
732
733
734
735       Display mapping information about keys:
736
737
738
739           $cbc hash foo bar baz
740           foo: [vBucket=115, Index=3] Server: cbnode3:11210, CouchAPI: http://cbnode3:8092/default
741           bar: [vBucket=767, Index=0] Server: cbnode1:11210, CouchAPI: http://cbnode1:8092/default
742           baz: [vBucket=36, Index=2] Server: cbnode2:11210, CouchAPI: http://cbnode2:8092/default
743
744
745
746       Create a bucket:
747
748
749
750           $ cbc bucket-create --bucket-type=memcached --ram-quota=100 --password=letmein -u Administrator -P 123456 mybucket
751           Requesting /pools/default/buckets
752           202
753             Cache-Control: no-cache
754             Content-Length: 0
755             Date: Sun, 22 Jun 2014 22:43:56 GMT
756             Location: /pools/default/buckets/mybucket
757             Pragma: no-cache
758             Server: Couchbase Server
759
760
761
762       Flush a bucket:
763
764
765
766           $ cbc bucket-flush default
767           Requesting /pools/default/buckets/default/controller/doFlush
768
769
770           200
771             Cache-Control: no-cache
772             Content-Length: 0
773             Date: Sun, 22 Jun 2014 22:53:44 GMT
774             Pragma: no-cache
775             Server: Couchbase Server
776
777
778
779       Delete a bucket:
780
781
782
783           $ cbc bucket-delete mybucket -P123456
784           Requesting /pools/default/buckets/mybucket
785           200
786             Cache-Control: no-cache
787             Content-Length: 0
788             Date: Sun, 22 Jun 2014 22:55:58 GMT
789             Pragma: no-cache
790             Server: Couchbase Server
791
792
793
794       Use cbc stats to determine the minimum and maximum timeouts for a  lock
795       operation:
796
797
798
799           $ cbc stats | grep ep_getl
800           localhost:11210 ep_getl_default_timeout 15
801           localhost:11210 ep_getl_max_timeout 30
802
803
804
805       Create a design document:
806
807
808
809           $ echo ´{"views":{"all":{"map":"function(doc,meta){emit(meta.id,null)}"}}}´ | cbc view -X PUT _design/blog
810           201
811             Cache-Control: must-revalidate
812             Content-Length: 32
813             Content-Type: application/json
814             Date: Sun, 22 Jun 2014 23:03:40 GMT
815             Location: http://localhost:8092/default/_design/blog
816             Server: MochiWeb/1.0 (Any of you quaids got a smint?)
817           {"ok":true,"id":"_design/blog"}
818
819
820
821       Query a view:
822
823
824
825           $ cbc view _design/blog/_view/all?limit=5
826           200
827             Cache-Control: must-revalidate
828             Content-Type: application/json
829             Date: Sun, 22 Jun 2014 23:06:09 GMT
830             Server: MochiWeb/1.0 (Any of you quaids got a smint?)
831             Transfer-Encoding: chunked
832           {"total_rows":20,"rows":[
833           {"id":"bin","key":"bin","value":null},
834           {"id":"check-all-libev-unit-tests.log","key":"check-all-libev-unit-tests.log","value":null},
835           {"id":"check-all-libevent-unit-tests.log","key":"check-all-libevent-unit-tests.log","value":null},
836           {"id":"check-all-select-unit-tests.log","key":"check-all-select-unit-tests.log","value":null},
837           {"id":"cmake_install.cmake","key":"cmake_install.cmake","value":null}
838           ]
839           }
840
841
842
843       Issue a N1QL query:
844
845
846
847           $ cbc query ´SELECT * FROM `travel-sample` WHERE type="airport" AND city=$city´ -Qscan_consistency=request_plus -A´$city=\"Reno\"´
848
849
850
851       Ping cluster services:
852
853
854
855           $ cbc ping --details  -Ucouchbase://192.168.1.101
856           {
857              "version" : 1,
858              "config_rev" : 54,
859              "id" : "0x1d67af0",
860              "sdk" : "libcouchbase/2.8.4",
861              "services" : {
862                 "fts" : [
863                    {
864                       "id" : "0x1d75e90",
865                       "latency_us" : 1500,
866                       "local" : "192.168.1.12:35232",
867                       "remote" : "192.168.1.101:8094",
868                       "status" : "ok"
869                    },
870                    {
871                       "id" : "0x1da6800",
872                       "latency_us" : 2301,
873                       "local" : "192.168.1.12:40344",
874                       "remote" : "192.168.1.103:8094",
875                       "status" : "ok"
876                    },
877                    {
878                       "id" : "0x1da3270",
879                       "latency_us" : 2820,
880                       "local" : "192.168.1.12:42730",
881                       "remote" : "192.168.1.102:8094",
882                       "status" : "ok"
883                    },
884                    {
885                       "details" : "LCB_ENETUNREACH (0x31): The remote host was unreachable - is your network OK?",
886                       "latency_us" : 3071733,
887                       "remote" : "192.168.1.104:8094",
888                       "status" : "error"
889                    }
890                 ],
891                 "kv" : [
892                    {
893                       "id" : "0x1d6bde0",
894                       "latency_us" : 3700,
895                       "local" : "192.168.1.12:42006",
896                       "remote" : "192.168.1.101:11210",
897                       "scope" : "default",
898                       "status" : "ok"
899                    },
900                    {
901                       "id" : "0x1dadcf0",
902                       "latency_us" : 5509,
903                       "local" : "192.168.1.12:39936",
904                       "remote" : "192.168.1.103:11210",
905                       "scope" : "default",
906                       "status" : "ok"
907                    },
908                    {
909                       "id" : "0x1dac500",
910                       "latency_us" : 5594,
911                       "local" : "192.168.1.12:33868",
912                       "remote" : "192.168.1.102:11210",
913                       "scope" : "default",
914                       "status" : "ok"
915                    },
916                    {
917                       "latency_us" : 2501688,
918                       "remote" : "192.168.1.104:11210",
919                       "scope" : "default",
920                       "status" : "timeout"
921                    }
922                 ],
923                 "n1ql" : [
924                    {
925                       "id" : "0x1d7f280",
926                       "latency_us" : 3235,
927                       "local" : "192.168.1.12:54210",
928                       "remote" : "192.168.1.101:8093",
929                       "status" : "ok"
930                    },
931                    {
932                       "id" : "0x1d76f20",
933                       "latency_us" : 4625,
934                       "local" : "192.168.1.12:58454",
935                       "remote" : "192.168.1.102:8093",
936                       "status" : "ok"
937                    },
938                    {
939                       "id" : "0x1da44b0",
940                       "latency_us" : 4477,
941                       "local" : "192.168.1.12:36678",
942                       "remote" : "192.168.1.103:8093",
943                       "status" : "ok"
944                    },
945                    {
946                       "details" : "LCB_ENETUNREACH (0x31): The remote host was unreachable - is your network OK?",
947                       "latency_us" : 3071843,
948                       "remote" : "192.168.1.104:8093",
949                       "status" : "error"
950                    }
951                 ],
952                 "views" : [
953                    {
954                       "id" : "0x1da55c0",
955                       "latency_us" : 1762,
956                       "local" : "192.168.1.12:52166",
957                       "remote" : "192.168.1.103:8092",
958                       "status" : "ok"
959                    },
960                    {
961                       "id" : "0x1da20d0",
962                       "latency_us" : 2016,
963                       "local" : "192.168.1.12:59420",
964                       "remote" : "192.168.1.102:8092",
965                       "status" : "ok"
966                    },
967                    {
968                       "id" : "0x1d6a740",
969                       "latency_us" : 2567,
970                       "local" : "192.168.1.12:38614",
971                       "remote" : "192.168.1.101:8092",
972                       "status" : "ok"
973                    },
974                    {
975                       "details" : "LCB_ENETUNREACH (0x31): The remote host was unreachable - is your network OK?",
976                       "latency_us" : 3071798,
977                       "remote" : "192.168.1.104:8092",
978                       "status" : "error"
979                    }
980                 ]
981              }
982           }
983
984
985

FILES

987       cbc(1)  and cbc-pillowfight(1) may also read options from cbcrc(4). The
988       default path for cbcrc is $HOME/.cbcrc, but may be overridden  by  set‐
989       ting the CBC_CONFIG evironment variable to an alternate path.
990

BUGS

992       The  options  in this utility and their behavior are subject to change.
993       This script should be used for experiemntation only and not inside pro‐
994       duction scripts.
995

SEE ALSO

997       cbc-pillowfight(1), cbcrc(4)
998

History

1000       The  cbc command first appeared in version 0.3.0 of the library. It was
1001       significantly rewritten in version 2.4.0
1002
1003
1004
1005                                  April 2019                            CBC(1)
Impressum