Managing Connections
This section describes how to connect the Node.js Columnar SDK to a Columnar cluster. It contains best practices as well as information on TLS/SSL and advanced connection options.
Our Getting Started pages cover the basics of making a connection to a Capella Columnar cluster. This page is a wider look at the topic.
|
Don’t Mix Columnar & Operational SDKs.
Do not combine the Node.js Columnar SDK with the Node.js Operational SDK on the same app server (or development machine). This combination is not tested and not supported. There may be problems with different versions of shared dependencies if you try this. This only applies to the Node.js and Python Columnar SDKs. Note, this does not apply to combining our Enterprise Analytics SDKs with our Operational SDKs. See the Analytics SDK page for a reminder of which Analytics SDK to use with which Analytics service. |
Connecting to a Cluster
A connection to a Columnar cluster is represented by a columnar object.
Connect to Columnar by calling columnar.createInstance with the connection string, credentials, and any required optional parameters.
const columnar = require('couchbase-columnar')
async function main() {
// Update this to your cluster
const clusterConnStr = 'couchbases://--your-instance--'
const username = 'username'
const password = 'Password123!'
// User Input ends here.
const credential = new columnar.Credential(username, password)
const cluster = columnar.createInstance(clusterConnStr, credential)
| Capella’s root certificate is not signed by a well known Certificate Authority. However, the certificate is bundled with the SDK, and is automatically trusted unless you specify a different certificate to trust. |
Connection Strings
A Couchbase connection string is a comma-delimited list of IP addresses and/or hostnames, optionally followed by a list of parameters.
The parameter list is just like the query component of a URI; name-value pairs have an equals sign (=) separating the name and value, with an ampersand (&) between each pair.
Just as in a URI, the first parameter is prefixed by a question mark (?).
For Columnar, as for all Capella products, connection must be made with Transport Layer Security (TLS) — for full encryption of client-side traffic — for which the couchbases:// schema is used as the root of the connection string (note the trailing s).
couchbases://cb.<your-endpoint>.cloud.couchbase.com
couchbases://cb.<your-endpoint>.cloud.couchbase.com?timeout.connect_timeout=75s&timeout.query_timeout=100s
The full list of recognized parameters is documented in the client settings reference.
Local Development
We strongly recommend that the client and server are in the same LAN-like environment (e.g. AWS Region). As this may not always be possible during development, read the guidance on working with constrained network environments. More details on connecting your client code to Couchbase Capella can be found in the Capella Operational docs.