A newer version of this documentation is available.

View Latest
March 23, 2025
+ 12
How to connect to a Couchbase Cluster.

Introduction

Connecting to Couchbase can be done in several ways. This guide will take you through some of the most common methods used to access a Couchbase cluster with an SDK client or CLI tool.

A Couchbase Cluster is a combination of multiple server nodes, which can be accessed by users or applications with a username and password. Each server node can also be its own cluster or join an existing multi-node setup.

Couchbase uses Role Based Access Control (RBAC) to control access to its various services. A user or application can connect to a cluster and use these services, assuming that valid credentials with relevant access roles are provided.

Before You Begin

If you want to try out the examples in this section, follow the instructions given in Do a Quick Install to install Couchbase Server, configure a cluster, and load a sample dataset.

Couchbase Clients

Clients access data by connecting to a Couchbase cluster over the network. The most common type of client is a Couchbase SDK, which is a full programmatic API that enables applications to take the best advantage of Couchbase. This developer guide focuses on the most commonly-used SDKs, but full explanations and reference documentation for all SDKs is available.

The command line clients also provide a quick and streamlined interface for simple access and are suitable if you just want to access an item without writing any code.

With some editions, the command line clients are provided as part of the installation of Couchbase Server. Assuming a default installation, you can find them in the following location, depending on your operating system:

Linux

/opt/couchbase/bin

Windows

C:\Program Files\Couchbase\Server\bin

macOS

/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin

If the command line client is not provided with your installation of Couchbase Server, you must install the C SDK in order to use the command line clients.

Read the following for further information about the clients available:

Connecting to Couchbase Server

Couchbase Server can be configured to run with unencrypted or encrypted network access. When running Couchbase in a production environment, the latter is always recommended.

Basic Auth

To connect to a standalone or Docker installation with unencrypted network access, set up a user with appropriate access levels and a secure password.

To access a cluster via the Couchbase Server Web Console over an unencrypted connection, navigate to the Web Console address with your browser (by default, localhost:8091) and enter your credentials.

The Couchbase Admin

See Authenticating with the Console for more information.

TLS

To connect to a cluster configured with TLS (Transport Layer Security), for encrypted network access, you must supply an X.509 certificate. Before using X.509 certificate based authentication, you should run through the following:

To access a cluster via the Couchbase Server Web Console over an encrypted connection, navigate to the secure Web Console address with your browser (by default, https://localhost:18091) and enter your credentials.

The Couchbase Admin

See Manage Console Access for more information.

Connecting to Couchbase Capella

To connect to the database via Couchbase Capella, create a valid account and set up some database credentials.

The Security Certificate

Download a security certificate to connect an SDK or CLI client to Capella.

Navigate to https://cloud.couchbase.com/login to access the Capella Web Console.

The Couchbase Capella Login

See Cluster and Data for more information.

Reference and explanation:

Connecting with SDKs: