Igl3
Igl3

Reputation: 5108

Get names of couchbase nodes from Bucket

I'm trying to get the hostnames of all nodes which are used by my bucket. I want to do that dynamically, as my application is going to run on different server setups.

I thought about getting them via the bucket in my code.

By .stats() I know I can get a lot of statistics. But I could not find the node names there.

Is there a proper way to retreive the Node names used by a bucket via the python api?

Upvotes: 0

Views: 91

Answers (1)

Mark Nunberg
Mark Nunberg

Reputation: 3701

http://pythonhosted.org/couchbase/api/couchbase.html#couchbase.bucket.Bucket.server_nodes

Use bucket.server_nodes. This will give you a list of [host:rest_port] for all nodes in the cluster.

Upvotes: 1

Related Questions