Test connection to couchbase possibilities

I have codded PowerShell script wrapping couchbase cli inside it, I know it is a bad idea but being a windows guys I am used to powershell.

As a first layer i am checking the connectivity to couchbase server taking the status field from server-info command to check the connectivity to the serve, based on the value I am determining the access to the server.

one scenario where I was struck is, the status says healthy and when i query for list of users using user-manage it throws below error.
ERROR: Cluster is not initialized, use cluster-init to initialize the cluster.

do we have any specific command to check the connection and health of the server.

@sagarkvs user-manage allows administrators to assign and manage roles to different users - for this to work the cluster has to be initialized first - hence the error - without initializing the cluster you cannot use this command - if you execute it on a uninitialized cluster it will return this error:

mv-arunkumar:bin a.senthilnathan$ ./couchbase-cli user-manage -c --username Administrator --password password --get
ERROR: Cluster is not initialized, use cluster-init to initialize the cluster
mv-arunkumar:bin a.senthilnathan$

However, server-info command should work even if it is not initialized - it should give you a json which contains the server status as shown below:

mv-arunkumar:bin a.senthilnathan$ ./couchbase-cli server-info -c --username Administrator --password password
{
“availableStorage”: {
“hdd”: [
{
“path”: “/”,
“sizeKBytes”: 19363840,
“usagePercent”: 47
},
{
“path”: “/dev”,
“sizeKBytes”: 757848,
“usagePercent”: 0
},
{
“path”: “/dev/shm”,
“sizeKBytes”: 767172,
“usagePercent”: 0
},
{
“path”: “/run”,
“sizeKBytes”: 767172,
“usagePercent”: 2
},
{
“path”: “/sys/fs/cgroup”,
“sizeKBytes”: 767172,
“usagePercent”: 0
},
{
“path”: “/”,
“sizeKBytes”: 19363840,
“usagePercent”: 47
},
{
“path”: “/boot”,
“sizeKBytes”: 508588,
“usagePercent”: 24
},
{
“path”: “/run/user/0”,
“sizeKBytes”: 153436,
“usagePercent”: 0
}
]
},
“cbasMemoryQuota”: 1024,
“clusterCompatibility”: 393221,
“clusterMembership”: “active”,
“couchApiBase”: “http://:8092/”,
“couchApiBaseHTTPS”: “https://:18092/”,
“cpuCount”: 1,
“eventingMemoryQuota”: 256,
“ftsMemoryQuota”: 256,
“hostname”: “:8091”,
“indexMemoryQuota”: 512,
“interestingStats”: {},
“mcdMemoryAllocated”: 1198,
“mcdMemoryReserved”: 1198,
“memoryFree”: 1246457856,
“memoryQuota”: 256,
“memoryTotal”: 1571168256,
“nodeUUID”: “241de848670ff1908ec8cdfcaafcd739”,
“os”: “x86_64-unknown-linux-gnu”,
“otpCookie”: “6f9d7b5c2938c99876c3f2cc4438479ae0a2562be32dd9641caf672173ab77e0”,
“otpNode”: "ns_1@127.0.0.1",
“ports”: {
“direct”: 11210,
“httpsCAPI”: 18092,
“httpsMgmt”: 18091
},
“recoveryType”: “none”,
“services”: [
“kv”
],
"status": “healthy”,
“storage”: {
“hdd”: [
{
“cbas_dirs”: [
“/opt/couchbase/var/lib/couchbase/data”
],
“index_path”: “/opt/couchbase/var/lib/couchbase/data”,
“java_home”: “”,
“path”: “/opt/couchbase/var/lib/couchbase/data”,
“quotaMb”: “none”,
“state”: “ok”
}
],
“ssd”:
},
“storageTotals”: {
“hdd”: {
“free”: 10509143245,
“quotaTotal”: 19828572160,
“total”: 19828572160,
“used”: 9319428915,
“usedByData”: 0
},
“ram”: {
“quotaTotal”: 268435456,
“quotaTotalPerNode”: 268435456,
“quotaUsed”: 0,
“quotaUsedPerNode”: 0,
“total”: 1571168256,
“used”: 1467150336,
“usedByData”: 0
}
},
“systemStats”: {
“cpu_cores_available”: 1,
“cpu_utilization_rate”: 0,
“mem_free”: 1246457856,
“mem_limit”: 1571168256,
“mem_total”: 1571168256,
“swap_total”: 1107292160,
“swap_used”: 0
},
“thisNode”: true,
“uptime”: “17”,
“version”: “”
}

What couchbase version are you using? Ensure couchbase is installed fine and you are able to see the setup page when you hit 8091 - also make sure that you are using the right creds

we are using community edition, do we have any other way to check the health of the server. Meaning whether the cluster is setup or not.

I am using clusterMembership field also to determine the cluster configured or not.