Browser and CLI Access

    +
    Web and command line interfaces to Couchbase Server are available. Installation of the cbc command line tools is covered here, and links are given to the man pages, for full usage instuctions. The Web console is documented in the Server docs.

    Web and command line interfaces to Couchbase Server are available. The cbc command line tools are a part of libcouchbase, with installation documented below, whilst Web console access is provided in Couchbase Server — see links.

    Command Line

    You can access documents in Couchbase using command line interfaces. Libcouchbase (LCB), our C SDK, includes the cbc tools. This is in addition to the command line tools integrated into Couchbase Server to manage the cluster and to collect diagnostics.

    A version of LCB ships with some releases of Couchbase Server, but here we are assuming you want to install the command line tools on a client machine, or to acquire the latest version. To install the cbc command line tools, install libcouchbase:

    If you already have LCB installed, then skip ahead to our summary of tools included on cbc.

    Platform support and installation

    The Couchbase C SDK can be installed via apt or yum repositories on GNU/Linux; homebrew on Mac OS X; and binary archives for Microsoft Windows.

    It may also be built from source on any of the platforms mentioned above, and more.

    Installation from source

    You may install the library from source either by downloading a source archive, or by checking out the git repository. Follow the instructions in the archive’s README for further instructions.

    Installing on GNU/Linux

    The various Linux distributions contain the following packages:

    • libcouchbase3: The core library package.

    • libcouchbase-dev (or libcouchbase-devel): The development package, required if building SDKs which depend on the C SDK.

    • libcouchbase3-tools: The command line utilities (cbc and others).

    • libcouchbase3-libevent: Optional but recommended component for I/O performance. Can also be used to integrate with libevent (see Asynchronous Programming).

    • libcouchbase3-libev: Optional, for use with applications that make use of event loop integration with libev (see Asynchronous Programming). To install the C SDK from a static binary package or by manually configuring the repositories, you can use the following procedures.

    Configuring yum repositories (CentOS, Redhat)

    This section assumes you know how to add an external yum repository. To configure the repository:

    1. Find the appropriate repository location for your distribution in the following table.

      Version

      Architecture

      Repository

      Amazon Linux 2

      aarch64

      https://packages.couchbase.com/clients/c/repos/rpm/amzn2/aarch64

      Amazon Linux 2

      x86_64

      https://packages.couchbase.com/clients/c/repos/rpm/amzn2/x86_64

      Enterprise Linux 8

      x86_64

      https://packages.couchbase.com/clients/c/repos/rpm/el8/x86_64

      Enterprise Linux 7

      x86_64

      https://packages.couchbase.com/clients/c/repos/rpm/el7/x86_64

    2. Create a couchbase.repo file in your /etc/yum.repos.d directory. It should look similar to the following:

      [couchbase]
      enabled = 1
      name = libcouchbase package for centos8 x86_64
      baseurl = https://packages.couchbase.com/clients/c/repos/rpm/el8/x86_64
      gpgcheck = 1
      gpgkey = https://packages.couchbase.com/clients/c/repos/rpm/couchbase.key

    Now that you have the repository configured, refresh the cache then check to see that you have been successful:

    $ sudo yum check-update
    $ sudo yum search libcouchbase

    Now, install libcouchbase3, and any other packages that you need for development:

    $ sudo yum install libcouchbase3 libcouchbase-devel libcouchbase3-tools

    Configuring APT repositories (Debian, Ubuntu)

    This section assumes some knowledge of apt. To configure the repository:

    1. Download the Couchbase GPG key from https://packages.couchbase.com/clients/c/repos/deb/couchbase.key

    2. Add the key to the list of trusted package keys. Use the apt-key add command. For example, apt-key add couchbase.key.

    3. Create a couchbase.list file in /etc/apt/sources.list.d. The file should contain the repository for your distribution. Repositories are available for the following distributions:

    Distribution

    Repository Entry

    Ubuntu 16.04 ("xenial")

    deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1604 xenial xenial/main

    Ubuntu 18.04 ("bionic")

    deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu1804 bionic bionic/main

    Ubuntu 20.04 ("focal")

    deb https://packages.couchbase.com/clients/c/repos/deb/ubuntu2004 focal focal/main

    Debian 9 ("stretch")

    deb https://packages.couchbase.com/clients/c/repos/deb/debian9 stretch stretch/main

    Debian 10 ("buster")

    deb https://packages.couchbase.com/clients/c/repos/deb/debian10 buster buster/main

    Debian 11 ("bullseye")

    deb https://packages.couchbase.com/clients/c/repos/deb/debian11 bullseye bullseye/main

    Note that only Ubuntu LTS (long term support) releases are supported. You may try to use an LTS repository for a non-LTS version, but success is not guaranteed.

    Now that you have the repository configured, refresh the cache then check to see that you have been successful:

    $ sudo apt update
    $ sudo apt search libcouchbase

    You should see something like:

    libcouchbase-dbg - library for the Couchbase protocol, debug symbols
    libcouchbase-dev - library for the Couchbase protocol, development files
    libcouchbase3 - library for the Couchbase protocol, core files
    libcouchbase3-libev - library for the Couchbase protocol (libev backend)
    libcouchbase3-libevent - library for the Couchbase protocol (libevent backend)
    libcouchbase3-tools - library for the Couchbase protocol

    Now, install libcouchbase3, and any other packages that you need for development:

    $ sudo apt install libcouchbase3 libcouchbase-dev libcouchbase3-tools libcouchbase-dbg libcouchbase3-libev libcouchbase3-libevent

    Installing binary packages without a repository

    You can install standalone packages by downloading a tarball containing the necessary binary packages for your platform.

    Installing RPMs

    The following commands show steps to execute for the current version on a CentOS 8 box. Check the Downloads table for other Redhat based systems.

    $ curl -O https://packages.couchbase.com/clients/c/libcouchbase-3.2.1_centos8_x86_64.tar
    $ tar xf libcouchbase-3.2.1_centos8_x86_64.tar
    $ cd libcouchbase-3.2.1_centos8_x86_64
    $ sudo yum install -y libcouchbase3{-tools,-libevent,}-3.2.1*.rpm libcouchbase-devel-*.rpm
    > ...
    > Installed:
    >   libcouchbase-devel-3.2.1-1.el8.x86_64
    >   libcouchbase3-3.2.1-1.el8.x86_64
    >   libcouchbase3-libevent-3.2.1-1.el8.x86_64
    >   libcouchbase3-tools-3.2.1-1.el8.x86_64
    > ...
    >
    > Complete!

    Installing DEBs

    The following commands show steps to execute for the current version on a Debian 10 (buster) box. Check the Downloads table for the other DEB-based distributions.

    $ curl -O https://packages.couchbase.com/clients/c/libcouchbase-3.2.1_debian10_buster_amd64.tar
    $ tar xf libcouchbase-3.2.1_debian10_buster_amd64.tar
    $ cd libcouchbase-3.2.1_debian10_buster_amd64
    $ sudo apt install libevent-core-2.1
    $ sudo dpkg -i libcouchbase3{-tools,-libevent,}_3.2.1*.deb libcouchbase-dev*.deb
    > Selecting previously unselected package libcouchbase3-tools.
    > (Reading database ... 7177 files and directories currently installed.)
    > Preparing to unpack libcouchbase3-tools_3.2.1-1_amd64.deb ...
    > Unpacking libcouchbase3-tools (3.2.1-1) ...
    > Selecting previously unselected package libcouchbase3-libevent:amd64.
    > Preparing to unpack libcouchbase3-libevent_3.2.1-1_amd64.deb ...
    > Unpacking libcouchbase3-libevent:amd64 (3.2.1-1) ...
    > Selecting previously unselected package libcouchbase3:amd64.
    > Preparing to unpack libcouchbase3_3.2.1-1_amd64.deb ...
    > Unpacking libcouchbase3:amd64 (3.2.1-1) ...
    > Selecting previously unselected package libcouchbase-dev:amd64.
    > Preparing to unpack libcouchbase-dev_3.2.1-1_amd64.deb ...
    > Unpacking libcouchbase-dev:amd64 (3.2.1-1) ...
    > Setting up libcouchbase3:amd64 (3.2.1-1) ...
    > Setting up libcouchbase-dev:amd64 (3.2.1-1) ...
    > Setting up libcouchbase3-libevent:amd64 (3.2.1-1) ...
    > Setting up libcouchbase3-tools (3.2.1-1) ...
    > Processing triggers for libc-bin (2.28-10) ...

    Installation on Mac OS X

    To install the latest version of the library on Mac OS X, first install the de-facto package manager for OS X: homebrew. Once homebrew is configured:

    Get list of latest packages:

    $ brew update

    Install the latest version of libcouchbase:

    $ brew install libcouchbase

    To install development files and command line tools on Mac OS, or to install an earlier version of the library, follow the instructions for installing from source.

    Windows Installation

    Windows binary packages can be found in the Downloads table for each supported version of libcouchbase. Included are the header files, release and debug variants of the DLLs and import libraries, and release and debug variants of the command line tools. Note that the C SDK does not have any preferred installation path, and it is up to you to determine where to place libcouchbase.dll.

    Be sure to select the proper package for the compiler and architecture your application is using.

    If there are no binaries available for your Visual Studio version, then using a binary from any other Visual Studio version is likely to work. Most of the issues related to mixing Visual Studio binary versions involve changing and incompatible C APIs or incompatible C Runtime (CRT) objects and functions. Since the Couchbase C SDK does not expose a C API, and since it does not directly expose any CRT functionality, it should be safe for use so long as your application can link to the library at compile-time. The windows runtime linker will ensure that each binary is using the appropriate version of the Visual C Runtime (MSVCRT.DLL).

    If for some reason you cannot use any of the prebuilt Windows binaries, follow the instructions in installation from source (above) to build on Windows.

    Verifying Installed Package

    The easiest way to verify installed package is to check its version using cbc tools. It requires package libcouchbase3-tools installed on Linux systems, for Windows cbc.exe included in the zip archive. To verify the client run cbc version (cbc.exe version on Windows). Below is the output from version 3.2.0 on CentOS 8. It shows version along with git commit numbers. Then it prints default directory where IO plugins installed and enumerates the currently installed and available plugins. After that it reports whether OpenSSL linked to this particular version of libcouchbase, and displays the version number if it is accessible.

    $ cbc version
    cbc:
      Runtime: Version=3.2.0, Changeset=c712686af5825f2f05c89112e555cd09906aa727
      Headers: Version=3.2.0, Changeset=c712686af5825f2f05c89112e555cd09906aa727
      Build Timestamp: 2021-07-20 09:31:59
      Default plugin directory: /usr/lib64/libcouchbase
      IO: Default=libevent, Current=libevent, Accessible=libevent,select
      SSL Runtime: OpenSSL 1.1.1g FIPS  21 Apr 2020
      SSL Headers: OpenSSL 1.1.1g FIPS  21 Apr 2020
      Snappy: 1.1.8
      Tracing: SUPPORTED
      System: Linux-4.15.0-91-generic; x86_64
      CC: GNU 8.4.1; -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-strict-aliasing -ggdb3 -pthread
      CXX: GNU 8.4.1; -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-strict-aliasing -ggdb3 -pthread

    cbc Tools

    The cbc tools are documented in their respective man pages. Links to online versions in the latest API docs are provided below. They are fairly stable utilities, and do not tend to change across LCB versions, however, you can see all recent updates on their GitHub page.

    • cbc: cbc is a utility for communicating with a Couchbase cluster.

    • cbcrc: cbcrc is an optional configuration file used to provide default values for the cbc and cbc-pillowfight utilities.

    • cbc-subdoc: cbc-subdoc runs an interactive shell with commands from subdocument API.

    • cbc-pillowfight: cbc-pillowfight is a stress test for Couchbase Client and Cluster. It creates a specified number of threads each looping and performing get and set operations within the cluster.

    • cbc-n1qlback: cbc-n1qlback creates a specified number of threads each executing a set of user defined queries.

    Couchbase Web Console Document & Query Access

    You can use the Couchbase Web Console to view, edit, and create JSON documents up to 256KB in size — see the Couchbase Web Console in the Server docs.

    You can also use the Query Workbench to issue N1QL queries using the web console.