I am experimenting to create a lcb instance of type LCB_TYPE_CLUSTER for using REST API commands to a cluster, like checking cluster health, etc. This to avoid managing a separate HTTP connection.
As the management connection should be independent of the a bucket, I was expecting the lcb_create() and lcb_connect() to work with just the IP address(es) and credentials, but found that it either needs the name of an existing bucket, or without bucket it requires the ‘default’ bucket to be present in the cluster.
I.e.:
c_opts.version = 3; c_opts.v.v3.connstr = "127.0.0.1"; c_opts.v.v3.username = "Administrator"; c_opts.v.v3.passwd = "admin123"; c_opts.v.v3.type = LCB_TYPE_CLUSTER; c_opts.v.v3.io = con->io_opts; res = lcb_create(&con->couch_hndl, &c_opts);
Only works if the cluster has a bucket ‘default’
c_opts.version = 3; c_opts.v.v3.connstr = "127.0.0.1/myStore"; c_opts.v.v3.username = "Administrator"; c_opts.v.v3.passwd = "admin123"; c_opts.v.v3.type = LCB_TYPE_CLUSTER; c_opts.v.v3.io = con->io_opts; res = lcb_create(&con->couch_hndl, &c_opts);
Works if the cluster has a bucket ‘myStore’ instead of ‘default’.
Why is the ‘cluster’ connection tied to a specific bucket? Is there a way around that?
(The behaviour seems to be the same on 2.4.7, 2.7.4 and 2.7.5)
Without a bucket ‘default’ in the cluster, wget on /pools/default works just fine and reports the cluster status and stats.