©2015 - 2022 Chad’s Technoworks. Disclaimer and Terms of Use

Chad’s TechnoWorks My Journal On Technology

Information Technology

COUCHBASE CBC CLIENT INSTALL

COUCHBASE CBC Command Line Tool


CBC is a handy tool that comes with the Couchbase C Client package. One can do CRUD transactions via command line without building an application. Good for small scale document updates and queries done remotely on a user's platform.


LINUX Installation


LIBEVENT

Check if you have libevent installed. This is a pre-requisite for the c sdk.


[chad@lxnode4 Downloads]$ rpm -q libevent

package libevent is not installed


You can download the OS specific libevent RPM from pkg.org


Install libevent Package


[root@lxnode4 Downloads]# ls

couchbase-csdk-setup  libevent-1.4.13-4.el6.x86_64.rpm

[root@lxnode4 Downloads]#

[root@lxnode4 Downloads]# rpm -q libevent

package libevent is not installed

[root@lxnode4 Downloads]# rpm -i libevent-1.4.13-4.el6.x86_64.rpm

warning: libevent-1.4.13-4.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

[root@lxnode4 Downloads]# rpm -q libevent

libevent-1.4.13-4.el6.x86_64

[root@lxnode4 Downloads]#



CBC Installation Using Perl/YUM


1. Download Installation script for Perl.


[chad@lxnode4 Downloads]$ wget http://packages.couchbase.com/clients/c/couchbase-csdk-setup

--2015-12-03 11:37:38--  http://packages.couchbase.com/clients/c/couchbase-csdk-setup

Resolving packages.couchbase.com... 54.231.10.40

Connecting to packages.couchbase.com|54.231.10.40|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 9947 (9.7K) [text/x-perl]

Saving to: “couchbase-csdk-setup”


100%[=====================================================================================>] 9,947       --.-K/s   in 0s      


2015-12-03 11:37:38 (535 MB/s) - “couchbase-csdk-setup” saved [9947/9947]


[chad@lxnode4 Downloads]$ ls

couchbase-csdk-setup

[chad@lxnode4 Downloads]$ file couchbase-csdk-setup

couchbase-csdk-setup: a /usr/bin/perl script text executable

[chad@lxnode4 Downloads]$ ls -l

total 12

-rw-rw-r--. 1 chad chad 9947 Apr 20  2015 couchbase-csdk-setup

[chad@lxnode4 Downloads]$ less couchbase-csdk-setup

[chad@lxnode4 Downloads]$




2. Run perl installer script as root or sudo.


[root@lxnode4 Downloads]# perl couchbase-csdk-setup

Will determine the kind of system you are using

Can't exec "lsb_release": No such file or directory at couchbase-csdk-setup line 97.

Use of uninitialized value $rv in split at couchbase-csdk-setup line 98.

lsb_release not found. Parsing /etc/redhat-release

Architecture: 64bit. Package Type: RPM. Version: 6

Is this correct? [Y/n]Y


The file '/etc/yum.repos.d/couchbase.repo' already exists. Its contents are:

-- BEGIN --

[couchbase]

enabled = 1

name = Couchbase package repository

baseurl = http://packages.couchbase.com/rpm/6.2/x86_64

gpgcheck = 1

gpgkey = http://packages.couchbase.com/rpm/couchbase-rpm.key

-- END --


Should I replace it? [y/N] y


Running: yum install libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin

Loaded plugins: product-id, refresh-packagekit, security, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Setting up Install Process

couchbase                                                                                               | 2.5 kB     00:00     

Resolving Dependencies

--> Running transaction check

---> Package libcouchbase-devel.x86_64 0:2.5.4-1.el6 will be installed

--> Processing Dependency: libcouchbase2-core = 2.5.4-1.el6 for package: libcouchbase-devel-2.5.4-1.el6.x86_64

--> Processing Dependency: libcouchbase.so.2()(64bit) for package: libcouchbase-devel-2.5.4-1.el6.x86_64

---> Package libcouchbase2-bin.x86_64 0:2.5.4-1.el6 will be installed

---> Package libcouchbase2-libevent.x86_64 0:2.5.4-1.el6 will be installed

--> Running transaction check

---> Package libcouchbase2-core.x86_64 0:2.5.4-1.el6 will be installed

--> Finished Dependency Resolution


Dependencies Resolved


===============================================================================================================================

 Package                                 Arch                    Version                      Repository                  Size

===============================================================================================================================

Installing:

 libcouchbase-devel                      x86_64                  2.5.4-1.el6                  couchbase                   98 k

 libcouchbase2-bin                       x86_64                  2.5.4-1.el6                  couchbase                   98 k

 libcouchbase2-libevent                  x86_64                  2.5.4-1.el6                  couchbase                  6.1 k

Installing for dependencies:

 libcouchbase2-core                      x86_64                  2.5.4-1.el6                  couchbase                  256 k


Transaction Summary

===============================================================================================================================

Install       4 Package(s)


Total download size: 458 k

Installed size: 1.4 M

Is this ok [y/N]: y

Downloading Packages:

(1/4): libcouchbase-devel-2.5.4-1.el6.x86_64.rpm                                                        |  98 kB     00:00     

(2/4): libcouchbase2-bin-2.5.4-1.el6.x86_64.rpm                                                         |  98 kB     00:00     

(3/4): libcouchbase2-core-2.5.4-1.el6.x86_64.rpm                                                        | 256 kB     00:00     

(4/4): libcouchbase2-libevent-2.5.4-1.el6.x86_64.rpm                                                    | 6.1 kB     00:00     

-------------------------------------------------------------------------------------------------------------------------------

Total                                                                                          107 kB/s | 458 kB     00:04     

warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID cd406e62: NOKEY

Retrieving key from http://packages.couchbase.com/rpm/couchbase-rpm.key

Importing GPG key 0xCD406E62:

 Userid: "Couchbase Release Key (RPM) <support@couchbase.com>"

 From  : http://packages.couchbase.com/rpm/couchbase-rpm.key

Is this ok [y/N]: y

Importing GPG key 0xD9223EDA:

 Userid: "Couchbase Release Key <support@couchbase.com>"

 From  : http://packages.couchbase.com/rpm/couchbase-rpm.key

Is this ok [y/N]: y

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

  Installing : libcouchbase2-core-2.5.4-1.el6.x86_64                                                                       1/4

  Installing : libcouchbase-devel-2.5.4-1.el6.x86_64                                                                       2/4

  Installing : libcouchbase2-bin-2.5.4-1.el6.x86_64                                                                        3/4

  Installing : libcouchbase2-libevent-2.5.4-1.el6.x86_64                                                                   4/4

  Verifying  : libcouchbase-devel-2.5.4-1.el6.x86_64                                                                       1/4

  Verifying  : libcouchbase2-core-2.5.4-1.el6.x86_64                                                                       2/4

  Verifying  : libcouchbase2-bin-2.5.4-1.el6.x86_64                                                                        3/4

  Verifying  : libcouchbase2-libevent-2.5.4-1.el6.x86_64                                                                   4/4


Installed:

  libcouchbase-devel.x86_64 0:2.5.4-1.el6  libcouchbase2-bin.x86_64 0:2.5.4-1.el6  libcouchbase2-libevent.x86_64 0:2.5.4-1.el6


Dependency Installed:

  libcouchbase2-core.x86_64 0:2.5.4-1.el6                                                                                      


Complete!


Will verify your install..

cbc:

  Runtime: Version=2.5.4, Changeset=c1338729754e863cf4ef006be9ff9e749baa40cf

  Headers: Version=2.5.4, Changeset=c1338729754e863cf4ef006be9ff9e749baa40cf

  IO: Default=libevent, Current=libevent

  SSL: .. SUPPORTED

[root@lxnode4 Downloads]#


CBC installation is now done, and the cbc executable binary is located at /usr/bin.




CBC Offline Installation Using RPM


1. Download the tar file for your platform from Couchbase Tar Repository - C SDK Download


2. Manually install the RPM using root account or sudo.


[couchbas@lxnode4 ~]$ cp -rp libcouchbase-2.6.2_centos62_x86_64.tar /tmp

[couchbas@lxnode4 ~]$ cd /tmp

[couchbas@lxnode4 tmp]$ tar xvf libcouchbase-2.6.2_centos62_x86_64.tar

libcouchbase-2.6.2_centos62_x86_64/

libcouchbase-2.6.2_centos62_x86_64/libcouchbase2-libevent-2.6.2-1.el6.x86_64.rpm

libcouchbase-2.6.2_centos62_x86_64/libcouchbase2-core-2.6.2-1.el6.x86_64.rpm

libcouchbase-2.6.2_centos62_x86_64/libcouchbase2-libev-2.6.2-1.el6.x86_64.rpm

libcouchbase-2.6.2_centos62_x86_64/libcouchbase2-bin-2.6.2-1.el6.x86_64.rpm

libcouchbase-2.6.2_centos62_x86_64/libcouchbase-debuginfo-2.6.2-1.el6.x86_64.rpm

libcouchbase-2.6.2_centos62_x86_64/libcouchbase-devel-2.6.2-1.el6.x86_64.rpm

[couchbas@lxnode4 tmp]$

[couchbas@lxnode4 tmp]$ su -

Password:

[root@lxnode4 ~]# cd /tmp/libcouchbase-2.6.2_centos62_x86_64/

[root@lxnode4 libcouchbase-2.6.2_centos62_x86_64]#


For first time install (use -i)

Syntax:

rpm -ivh libcouchbase2-core-2.6.2-1.el6.x86_64.rpm \

libcouchbase-devel-2.6.2-1.el6.x86_64.rpm \

libcouchbase2-bin-2.6.2-1.el6.x86_64.rpm \

libcouchbase2-libevent-2.6.2-1.el6.x86_64.rpm


To upgrade (use -U)

Syntax:

rpm -Uvh libcouchbase2-core-2.6.2-1.el6.x86_64.rpm \

libcouchbase-devel-2.6.2-1.el6.x86_64.rpm \

libcouchbase2-bin-2.6.2-1.el6.x86_64.rpm \

libcouchbase2-libevent-2.6.2-1.el6.x86_64.rpm


[root@lxnode4 libcouchbase-2.6.2_centos62_x86_64]# rpm -Uvh libcouchbase2-core-2.6.2-1.el6.x86_64.rpm \

> libcouchbase-devel-2.6.2-1.el6.x86_64.rpm \

> libcouchbase2-bin-2.6.2-1.el6.x86_64.rpm \

> libcouchbase2-libevent-2.6.2-1.el6.x86_64.rpm

Preparing...                ########################################### [100%]

   1:libcouchbase2-core     ########################################### [ 25%]

   2:libcouchbase-devel     ########################################### [ 50%]

   3:libcouchbase2-bin      ########################################### [ 75%]

   4:libcouchbase2-libevent ########################################### [100%]

[root@lxnode4 libcouchbase-2.6.2_centos62_x86_64]#


NOTE: In order for cbc to communicate to a remote Couchbase server, your host firewall must be set properly.

     See Linux Host Firewall Configuration section for details.




CBC Configuration File


~/.cbcrc is an optinal configuration file where you can define default values for the cbc.

Each entry is a line with a key=value pair.


Common parameters:

connstr

This is the URI string used for connecting to a cluster.


Example REST API with custom port

connstr=http://lxnode1.vlabs.net:8000,lxnode2.vlabs.net:8001,lxnode3.vlabs.net:8002


Example custom memcached ports:

connstr=couchbase://localhost:9100,localhost:9200


password

This is the password used during authentication to your bucket.

Example:

password=myBucketPass


See Couchbase C Client Reference Guide for more details.