Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

cbping Should Be Your New Friend

DZone's Guide to

cbping Should Be Your New Friend

A new Couchbase utility resembling command line pings to check connectivity between for clusters.

· Database Zone
Free Resource

Learn how to create flexible schemas in a relational database using SQL for JSON.

If you have used the command line ping utility to check simple network connectivity between hosts, you know how useful it is. Well, there is a utility like that for Couchbase now. It is aptly named cbping, and it will check simple connectivity for a Couchbase cluster or to remote XDCR clusters.

cbping does simple connectivity tests to Couchbase to check the following kinds of things:

  • Are ports open that Couchbase needs?
  • Elapsed time taken for the ports to connect.
  • What nodes are in the cluster? Do the same tests on them as well.

In addition, it can also check the connectivity to XDCR target clusters. Just remember that it is testing connectivity from wherever cbping is running from and not from within the cluster, or a health check from within the cluster. It is a simple “can I connect to this target on these ports.”

To get the script to use, clone the GitHub repo for cbping.

Here is a sample output of a three-node Couchbase cluster:

$ python cbping.py -H 172.16.40.144 -P 8091 -u Administrator -p <password>
I will assume that you meant cluster mode
I will connect to: http://172.16.40.144:8091/pools/default and run some tests.
This cluster says there are 3 nodes in the cluster.

Cluster Node                   Node Status     Node CB version
------------                   -----------     ---------------
172.16.40.142:8091             healthy         4.5.0-2601-enterprise
172.16.40.143:8091             healthy         4.5.0-2601-enterprise
172.16.40.144:8091             healthy         4.5.0-2601-enterprise

Hostname             Port       Result                                   Elapsed Time*
--------             ----       ------                                   ------------
172.16.40.142        8091       SUCCESS                                  272.0
172.16.40.142        8092       SUCCESS                                  67.0
172.16.40.142        8093       SUCCESS                                  90.0
172.16.40.142        8094       [Errno 61] Connection refused            87.0
172.16.40.142        9100       [Errno 61] Connection refused            82.0
172.16.40.142        9102       [Errno 61] Connection refused            82.0
172.16.40.142        9103       [Errno 61] Connection refused            110.0
172.16.40.142        9104       [Errno 61] Connection refused            81.0
172.16.40.142        9105       [Errno 61] Connection refused            88.0
172.16.40.142        9998       [Errno 61] Connection refused            93.0
172.16.40.142        9999       SUCCESS                                  60.0
172.16.40.142        11207      SUCCESS                                  60.0
172.16.40.142        11209      SUCCESS                                  61.0
172.16.40.142        11210      SUCCESS                                  57.0
172.16.40.142        11211      SUCCESS                                  70.0
172.16.40.142        11214      SUCCESS                                  101.0
172.16.40.142        11215      [Errno 61] Connection refused            82.0
172.16.40.142        18091      SUCCESS                                  91.0
172.16.40.142        18092      SUCCESS                                  72.0
172.16.40.142        18093      SUCCESS                                  97.0
172.16.40.142        4369       SUCCESS                                  59.0
172.16.40.142        21100      SUCCESS                                  72.0
*Elapsed time is in microseconds.

Hostname             Port       Result                                   Elapsed Time*
--------             ----       ------                                   ------------
172.16.40.143        8091       SUCCESS                                  224.0
172.16.40.143        8092       SUCCESS                                  90.0
172.16.40.143        8093       [Errno 61] Connection refused            97.0
172.16.40.143        8094       [Errno 61] Connection refused            85.0
172.16.40.143        9100       SUCCESS                                  60.0
172.16.40.143        9102       SUCCESS                                  62.0
172.16.40.143        9103       [Errno 61] Connection refused            85.0
172.16.40.143        9104       [Errno 61] Connection refused            89.0
172.16.40.143        9105       SUCCESS                                  88.0
172.16.40.143        9998       [Errno 61] Connection refused            81.0
172.16.40.143        9999       [Errno 61] Connection refused            106.0
172.16.40.143        11207      SUCCESS                                  75.0
172.16.40.143        11209      SUCCESS                                  70.0
172.16.40.143        11210      SUCCESS                                  89.0
172.16.40.143        11211      [Errno 61] Connection refused            121.0
172.16.40.143        11214      SUCCESS                                  70.0
172.16.40.143        11215      [Errno 61] Connection refused            98.0
172.16.40.143        18091      SUCCESS                                  91.0
172.16.40.143        18092      SUCCESS                                  73.0
172.16.40.143        18093      [Errno 61] Connection refused            104.0
172.16.40.143        4369       SUCCESS                                  91.0
172.16.40.143        21100      SUCCESS                                  81.0
*Elapsed time is in microseconds.

Hostname             Port       Result                                   Elapsed Time*
--------             ----       ------                                   ------------
172.16.40.144        8091       SUCCESS                                  85.0
172.16.40.144        8092       SUCCESS                                  91.0
172.16.40.144        8093       [Errno 61] Connection refused            120.0
172.16.40.144        8094       [Errno 61] Connection refused            112.0
172.16.40.144        9100       SUCCESS                                  93.0
172.16.40.144        9102       SUCCESS                                  64.0
172.16.40.144        9103       [Errno 61] Connection refused            158.0
172.16.40.144        9104       [Errno 61] Connection refused            99.0
172.16.40.144        9105       SUCCESS                                  87.0
172.16.40.144        9998       [Errno 61] Connection refused            104.0
172.16.40.144        9999       SUCCESS                                  71.0
172.16.40.144        11207      SUCCESS                                  61.0
172.16.40.144        11209      SUCCESS                                  63.0
172.16.40.144        11210      SUCCESS                                  84.0
172.16.40.144        11211      SUCCESS                                  76.0
172.16.40.144        11214      SUCCESS                                  62.0
172.16.40.144        11215      [Errno 61] Connection refused            80.0
172.16.40.144        18091      SUCCESS                                  92.0
172.16.40.144        18092      SUCCESS                                  78.0
172.16.40.144        18093      [Errno 61] Connection refused            120.0
172.16.40.144        4369       SUCCESS                                  73.0
172.16.40.144        21100      SUCCESS                                  64.0
*Elapsed time is in microseconds.

-------------- Bucket Information --------------

I will get bucket info from: http://172.16.40.144:8091/pools/default/buckets

Bucket Name          itemCount  Bucket Type
-----------          ---------  -----------
crimes               3033827    Couchbase

As you can see, it checks all of the ports that Couchbase Server could be running on per the documentation. On the nodes above, not all ports are open and that is OK. The ones that are not open are the ones for encryption, internal calls, and other services I am not running on that node (e.g. Query, Index, Data, FTS, etc). If you want to see what each of the ports does in cbping, then put in a -v option in the command line — you will see a description for each, like so:

Hostname             Port       Result                                  Elapsed Time*   Description
--------             ----       ------                                  ------------    -----------
172.16.40.144        8091       SUCCESS                                 65.0            Console REST/HTTP
172.16.40.144        8092       SUCCESS                                 63.0            Views, queries, XDCR, design documents
172.16.40.144        8093       [Errno 61] Connection refused           111.0           Query services REST/HTTP
172.16.40.144        8094       [Errno 61] Connection refused           111.0           Search service external HTTP
172.16.40.144        9100       SUCCESS                                 62.0            Internal index admin
172.16.40.144        9102       SUCCESS                                 59.0            Internal index HTTP
172.16.40.144        9103       [Errno 61] Connection refused           82.0            Internal index build
172.16.40.144        9104       [Errno 61] Connection refused           80.0            Internal index build
172.16.40.144        9105       SUCCESS                                 54.0            Internal index maintenance
172.16.40.144        9998       [Errno 61] Connection refused           93.0            Internal REST
172.16.40.144        9999       SUCCESS                                 59.0            Internal GSI for internal admins
172.16.40.144        11207      SUCCESS                                 94.0            Memcached SSL for smart client libraries
172.16.40.144        11209      SUCCESS                                 59.0            Internal Bucket
172.16.40.144        11210      SUCCESS                                 58.0            Memcached for smart client lib or Moxi
172.16.40.144        11211      SUCCESS                                 57.0            Pre-existing Couchbase Server & memcached (non-smart) client libraries (such as Moxi)
172.16.40.144        11214      SUCCESS                                 57.0            SSL XDCR data encryption
172.16.40.144        11215      [Errno 61] Connection refused           93.0            SSL XDCR data encryption
172.16.40.144        18091      SUCCESS                                 110.0           Web Console SSL REST/HTTP traffic
172.16.40.144        18092      SUCCESS                                 64.0            SSL for views access, run queries, XDCR & update design documents
172.16.40.144        18093      [Errno 61] Connection refused           114.0           N1QL SSL
172.16.40.144        4369       SUCCESS                                 91.0            Erlang Port Mapper
172.16.40.144        21100      SUCCESS                                 85.0            Node data exchange


Create flexible schemas using dynamic columns for semi-structured data. Learn how.

Topics:
couchbase ,connectivity ,cloud ,clusters

Published at DZone with permission of Kirk Kirkconnell, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}