Client connection string

connections

#1

Hi when creating a connection string are the ips provided the server addresses to your specific couchbase instances or nodes??

like example: couchbase:// ip address, ipaddress

what do these ip addresses represent?


#2

Not sure if there’s a difference between a Couchbase instance or node.
They are basically the same thing. People usually just call them a Couchbase node.
And it refers to a specific Couchbase server you have installed on a separate computer.
Every running server has its own ip-address on the internet. ( provided you have installed them on a Cloud server provider, say something like Digital Ocean / Linode / any Amazon service )

Then you get an (ip4) ip address like 187.100.134.200, that can be accessed from the internet. Its like a unique identifier that points towards your specific Couchbase server. But if you have installed Couchbase on your own local computer, then the ip address is always: 127.0.0.1

And when its time to connect to your database, you simply provide the ip address of the server you want to connect to:

 var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
 cluster.authenticate('INSERT_USERNAME', 'INSERT_PASSWORD');
    
    var myBucket = cluster.openBucket('BUCKET_NAME', function (err) {
        if(err) return console.log(err);
        console.log('Connected to database'); 
    });

(The sample code above is using the Node.js driver to connect to the db. Could also have been the Php driver/Python/Java/etc. What you prefer best.)
Hope this helps :+1:


#3

That helps thanks a lot!