I know that if the value vb_replica_num falls below (1024 * the number of configured replicas) / the number of servers, then this indicates that a rebalance is required. However using the API how do we get the number of configured replicas and the number of servers?
You can query server config:
number of replicas
$ curl -uAdministrator:password -s localhost:8091/pools/default/b/default \
| jq .vBucketServerMap.numReplicas
1
number of nodes
$ curl -uAdministrator:password -s localhost:8091/pools/default/b/default \
| jq '.nodes | length'
1
Read more in the docs: https://developer.couchbase.com/documentation/server/current/rest-api/rest-bucket-info.html