1CBC(1) CBC(1)
2
3
4
6 cbc - Couchbase Client Commandline Utility
7
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
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
47 always show the full list of available commands.
48
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
66 exisiting 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
92 increased 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
106 automatically 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
114 before establishing connection.
115
116 --truststorepath=PATH
117 The path to the server´s SSL certificate. This is typically
118 required for SSL connectivity unless the certificate has already
119 been added to the OpenSSL installation on the system (only
120 applicable with couchbases:// scheme)
121
122 --certpath=PATH
123 The path to the server´s SSL certificate. This is typically
124 required for SSL connectivity unless the certificate has already
125 been added to the OpenSSL installation on the system (only
126 applicable 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
133 required 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
140 The following options may be included in the connection string (via the
141 -U option) as URI-style query params (e.g. couch‐
142 base://host/bucket?option1=value1&option2=value2) or as individual
143 key=value pairs passed to the -D switch (e.g. -Doption1=value1 -Dop‐
144 tion2=value). The -D will internally build the connection string, and
145 is provided as a convenience for options to be easily passed on the
146 command-line
147
148 · operation_timeout=SECONDS: Specify the operation timeout in sec‐
149 onds. This is the time the client will wait for an operation to
150 complete before timing it out. The default is 2.5
151
152 · config_cache=PATH: Enables the client to make use of a file based
153 configuration cache rather than connecting for the bootstrap opera‐
154 tion. If the file does not exist, the client will first connect to
155 the cluster and then cache the bootstrap information in the file.
156
157 · truststorepath=PATH: The path to the server´s SSL certificate. This
158 is typically required for SSL connectivity unless the certificate
159 has already been added to the OpenSSL installation on the system
160 (only applicable with couchbases:// scheme)
161
162 · certpath=PATH: The path to the server´s SSL certificate. This is
163 typically required for SSL connectivity unless the certificate has
164 already been added to the OpenSSL installation on the system (only
165 applicable with couchbases:// scheme). This also should contain
166 client certificate when certificate authentication used, and in
167 this case other public certificates could be extracted into trust‐
168 storepath chain.
169
170 · keypath=PATH: The path to the client SSL private key. This is typi‐
171 cally required for SSL client certificate authentication. The cer‐
172 tificate itself have to go first in chain specified by certpath
173 (only applicable with couchbases:// scheme)
174
175 · ssl=no_verify: Temporarily disable certificate verification for SSL
176 (only applicable with couchbases:// scheme). This should only be
177 used for quickly debugging SSL functionality.
178
179 · sasl_mech_force=MECHANISM: Force a specific SASL mechanism to be
180 used when performing the initial connection. This should only need
181 to be modified for debugging purposes. The currently supported
182 mechanisms are PLAIN and CRAM-MD5
183
184 · bootstrap_on=<both,http,cccp>: Specify the bootstrap protocol the
185 client should use when attempting to connect to the cluster.
186 Options are: cccp: Bootstrap using the Memcached protocol (sup‐
187 ported on clusters 2.5 and greater); http: Bootstrap using the HTTP
188 REST protocol (supported on any cluster version); and both: First
189 attempt bootstrap over the Memcached protocol, and use the HTTP
190 protocol if Memcached bootstrap fails. The default is both
191
192 · enable_tracing=true/false: Activate/deactivate end-to-end tracing.
193
194 · tracing_orphaned_queue_flush_interval=SECONDS: Flush interval for
195 orphaned spans queue in default tracer. This is the time the tracer
196 will wait between repeated attempts to flush most recent orphaned
197 spans. Default value is 10 seconds.
198
199 · tracing_orphaned_queue_size=NUMBER: Size of orphaned spans queue in
200 default tracer. Queues in default tracer has fixed size, and it
201 will remove information about older spans, when the limit will be
202 reached before flushing time. Default value is 128.
203
204 · tracing_threshold_queue_flush_interval=SECONDS: Flush interval for
205 spans with total time over threshold in default tracer. This is the
206 time the tracer will wait between repeated attempts to flush
207 threshold queue. Default value is 10 seconds.
208
209 · tracing_threshold_queue_size=NUMBER: Size of threshold queue in
210 default tracer. Queues in default tracer has fixed size, and it
211 will remove information about older spans, when the limit will be
212 reached before flushing time. Default value is 128.
213
214 · tracing_threshold_kv=SECONDS: Minimum time for the tracing span of
215 KV service to be considered by threshold tracer. Default value is
216 0.5 seconds.
217
218 · tracing_threshold_n1ql=SECONDS: Minimum time for the tracing span
219 of N1QL service to be considered by threshold tracer. Default value
220 is 1 second.
221
222 · tracing_threshold_view=SECONDS: Minimum time for the tracing span
223 of VIEW service to be considered by threshold tracer. Default value
224 is 1 second.
225
226 · tracing_threshold_fts=SECONDS: Minimum time for the tracing span of
227 FTS service to be considered by threshold tracer. Default value is
228 1 second.
229
230 · tracing_threshold_analytics=SECONDS: Minimum time for the tracing
231 span of ANALYTICS service to be considered by threshold tracer.
232 Default value is 1 second.
233
234
235
237 The following commands are supported by cbc. Unless otherwise speci‐
238 fied, each command supports all of the options above.
239
240 cat
241 Write the value of keys to standard output.
242
243 This command requires that at least one key may be passed to it, but
244 may accept multiple keys. The keys should be specified as positional
245 arguments after the command.
246
247 In addition to the options in the OPTIONS section, the following
248 options are supported:
249
250 r, --replica=all|INDEX
251 Read the value from a replica server. The value for this option
252 can either be the string all which will cause the client to
253 request the value from each replica, or INDEX where INDEX is a
254 0-based replica index.
255
256 e, --expiry=EXPIRATION
257 Specify that this operation should be a get-and-touch operation
258 in which the key´s expiry time is updated along with retrieving
259 the item.
260
261 create
262 cp
263 Create a new item in the cluster, or update the value of an existing
264 item. By default this command will read the value from standard input
265 unless the --value option is specified.
266
267 The cp command functions the same, except it operates on a list of
268 files. Each file is stored in the cluster under the name specified on
269 the command line.
270
271 In addition to the options in the OPTIONS section, the following
272 options are supported:
273
274 -V, --value=VALUE
275 The value to store in the cluster. If omitted, the value is read
276 from standard input. This option is valid only for the create
277 command.
278
279 f, --flags=ITEMFLAGS
280 A 32 bit unsigned integer to be stored alongside the value. This
281 number is returned when the item is retrieved again. Other
282 clients commonly use this value to determine the type of item
283 being stored.
284
285 e, --expiry=EXPIRATION
286 The number of time in seconds from now at which the item should
287 expire.
288
289 M, --mode=upsert|insert|replace
290 Specify the storage mode. Mode can be one of insert (store item
291 if it does not yet exist), replace (only store item if key
292 already exists), or upsert (unconditionally store item)
293
294 p, --persist-to=NUMNODES
295 Wait until the item has been persisted to at least NUMNODES
296 nodes´ disk. If NUMNODES is 1 then wait until only the master
297 node has persisted the item for this key. You may not specify a
298 number greater than the number of nodes actually in the cluster.
299
300 r --replicate-to=NREPLICAS
301 Wait until the item has been replicated to at least NREPLICAS
302 replica nodes. The bucket must be configured with at least one
303 replica, and at least NREPLICAS replica nodes must be online.
304
305 observe
306 Retrieve persistence and replication information for items.
307
308 This command will print the status of each key to standard error.
309
310 See the OPTIONS for accepted options
311
312 incr
313 decr
314 These commands increment or decrement a counter item in the cluster. A
315 counter is a value stored as an ASCII string which is readable as a
316 number, thus for example 42.
317
318 These commands will by default refuse to operate on an item which does
319 not exist in the cluster.
320
321 The incr and decr command differ with how they treat the --delta argu‐
322 ment. The incr command will treat the value as a positive offset and
323 increment the current value by the amount specified, whereas the decr
324 command will treat the value as a negative offset and decrement the
325 value by the amount specified.
326
327 In addition to OPTIONS, the following options are supported:
328
329 --initial=_DEFAULT_
330 Set the initial value for the item if it does not exist in the
331 cluster. The value should be an unsigned 64 bit integer. If this
332 option is not specified and the item does not exist, the opera‐
333 tion will fail. If the item does exist, this option is ignored.
334
335 --delta=DELTA
336 Set the absolute delta by which the value should change. If the
337 command is incr then the value will be incremented by this
338 amount. If the command is decr then the value will be decre‐
339 mented by this amount. The default value for this option is 1.
340
341 -e, --expiry=EXPIRATION
342 Set the expiration time for the key, in terms of seconds from
343 now.
344
345 hash
346 Display mapping information for a key.
347
348 This command diplays mapping information about a key. The mapping
349 information indicates which vBucket the key is mapped to, and which
350 server is currently the master node for the given vBucket.
351
352 See the OPTIONS for accepted options
353
354 lock
355 Lock an item in the cluster.
356
357 This will retrieve and lock an item in the cluster, making it inacces‐
358 sible for modification until it is unlocked (see unlock).
359
360 In addition to the common options (OPTIONS), this command accepts the
361 following options:
362
363 e, --expiry=LOCKTIME
364 Specify the amount of time the lock should be held for. If not
365 specified, it will default to the server side maximum of 15 sec‐
366 onds.
367
368 unlock
369 Unlock a previously locked item.
370
371 This command accepts two mandatory positional arguments which are the
372 key and CAS value. The CAS value should be specified as printed from
373 the lock command (i.e. with the leading 0x hexadecimal prefix).
374
375 See the OPTIONS for accepted options
376
377 rm
378 Remove an item from the cluster.
379
380 This command will remove an item from the cluster. If the item does not
381 exist, the operation will fail.
382
383 See the OPTIONS for accepted options
384
385 stats
386 Retrieve a list of cluster statistics. If positional arguments are
387 passed to this command, only the statistics classified under those keys
388 will be retrieved. See the server documentation for a full list of pos‐
389 sible statistics categories.
390
391 This command will contact each server in the cluster and retrieve that
392 node´s own set of statistics.
393
394 The statistics are printed to standard output in the form of SERVER
395 STATISTIC VALUE where SERVER is the host:port representation of the
396 node from which has provided this statistic, STATISTIC is the name of
397 the current statistical key, and VALUE is the value for this statistic.
398
399 See the OPTIONS for accepted options
400
401 watch
402 Retrieve a list of cluster statistics, select specified sub-keys and
403 aggregate values across the cluster. Then continuously poll the stats
404 and display the difference with the previous values. If the list of
405 stat sub-keys not specified, the command will use cmd_total_ops,
406 cmd_total_gets, cmd_total_sets.
407
408 In addition to the options in the OPTIONS section, the following
409 options are supported: * -n, --interval=VALUE: Update interval in sec‐
410 onds (default 1 second).
411
412 keygen
413 Output list of keys that equally distribute amongst every vbucket.
414
415 In addition to the options in the OPTIONS section, the following
416 options are supported: * --keys-per-vbucket=VALUE: Number of keys to
417 generate per vBucket (default 1).
418
419 write-config
420 Write the configuration file based on arguments passed.
421
422 strerror
423 Decode library error code
424
425 version
426 Display information about the underlying version of libcouchbase to
427 which the cbc binary is linked.
428
429 verbosity
430 Set the memcached logging versbosity on the cluster. This affects how
431 the memcached processes write their logs. This command accepts a single
432 positional argument which is a string describing the verbosity level to
433 be set. The options are detail, debug info, and warning.
434
435 ping
436 Sends NOOP-like request to every service on each cluster node, and
437 report time it took to response.
438
439 --details
440 Provide more details about status of the service.
441
442 mcflush
443 Flush a memcached bucket. This command takes no arguments, and will
444 fail if the bucket specified is not a memcached bucket. You may also
445 use bucket-flush to flush any bucket (including a couchbase bucket).
446 The mcflush command may be quicker for memcached buckets, though.
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
468 default method is GET to query a view. To delete an existing
469 design document, specify DELETE, and to create a new design doc‐
470 ument, specify PUT.
471
472 query
473 Execute a N1QL Query. The cluster must have at least one query node
474 enabled.
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
512 input
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
519 default 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
528 options 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
546 everyone 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
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
624 interactively:
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
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
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
997 cbc-pillowfight(1), cbcrc(4)
998
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 December 2018 CBC(1)