REST - /v1/nodes
Usageโ
The nodes endpoint accepts a GET
request:
GET /v1/nodes
And it returns a nodes
field containing array of nodes with following fields:
name
: Name of the node.status
: Status of the node (one of: HEALTHY, UNHEALTHY, UNAVAILABLE).version
: Version of Weaviate running on the node.gitHash
: Short git hash of latest commit of Weaviate running on the node.stats
: Statistics of the node with following fields:shardCount
: Total number of shards on the node.objectCount
Total number of objects on the node.
shards
: Array of shards with following fields:name
: Name of the shard.class
: Name of the objects' class stored on the shard.objectCount
: Number of objects on the shard.
Exampleโ
The following command:
- Python
- JavaScript
- Go
- Java
- Curl
import weaviate
client = weaviate.Client("http://localhost:8080")
nodes_status = client.cluster.get_nodes_status()
print(nodes_status)
const weaviate = require('weaviate-client');
const client = weaviate.client({
scheme: 'http',
host: 'localhost:8080',
});
client.cluster
.nodesStatusGetter()
.do()
.then(console.log)
.catch(console.error);
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
)
func main() {
cfg := weaviate.Config{
Host: "localhost:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
nodesStatus, err := client.Cluster().
NodesStatusGetter().
Do(context.Background())
if err != nil {
panic(err)
}
fmt.Printf("%v", nodesStatus)
}
package io.weaviate;
import io.weaviate.client.Config;
import io.weaviate.client.WeaviateClient;
import io.weaviate.client.base.Result;
import io.weaviate.client.v1.cluster.model.NodesStatusResponse;
public class App {
public static void main(String[] args) {
Config config = new Config("http", "localhost:8080");
WeaviateClient client = new WeaviateClient(config);
Result<NodesStatusResponse> result = client.cluster()
.nodesStatusGetter()
.run();
if (result.hasErrors()) {
System.out.println(result.getError());
return;
}
System.out.println(result.getResult());
}
}
$ curl http://localhost:8080/v1/nodes
returns:
{
"nodes": [
{
"name": "weaviate-7",
"status": "HEALTHY",
"version": "1.16-alpha.0",
"gitHash": "8cd2efa",
"stats": {
"shardCount":2,
"objectCount": 23328
},
"shards": [
{
"name":"azuawSAd9312F",
"class": "Class_7",
"objectCount": 13328
}, {
"name":"cupazAaASdfPP",
"class": "Foo",
"objectCount": 10000
}
]
}, {
"name": "weaviate-6",
"status": "HEALTHY",
"version": "1.16-alpha.0",
"gitHash": "8cd2efa",
"stats": {
"shardCount":2,
"objectCount": 12345
},
"shards": [
{
"name":"hh8gXiaNaO2K",
"class": "Bar",
"objectCount": 10000
}, {
"name":"zmb16QK4PYZ4",
"class": "Baz",
"objectCount": 2345
}
]
}
]
}
More Resourcesโ
If you can't find the answer to your question here, please look at the:
- Frequently Asked Questions. Or,
- Knowledge base of old issues. Or,
- For questions: Stackoverflow. Or,
- For more involved discussion: Weaviate Community Forum. Or,
- We also have a Slack channel.