Development

Weaviate Database Nodes

In this tutorial, we will explore the various methods to get details about a given Weaviate node.
Captain Salem 2 min read
Weaviate Database Nodes

Weaviate is a graph-based, cloud-native, vector search engine that leverages semantic embeddings and knowledge graphs to enable efficient and accurate search, retrieval, and exploration of complex data structures at scale.

A Weaviate node refers to an individual instance or installation of the Weaviate database. It represents a single unit within a distributed network that stores and processes data using the Weaviate architecture.

Each node in Weaviate can function independently or collaborate with other nodes to form a decentralized network for data storage, retrieval, and search operations.

Sometimes, you may need to gather information about a given node.

Requirements

To follow along with this post, you will need the following:

  1. An HTTP client such as cURL.
  2. Python 3.10 and above
  3. A running Weaviate instance
  4. Weaviate Python Client

Weaviate Get Node Info – HTTP Endpoint

The first method we can use to get information about a Weaviate node is the /v1/nodes HTTP endpoint.

We can make a GET request as shown:

GET /v1/nodes

The query should return information about the nodes as:

  • 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.

The following command shows how to use cURL to request the nodes endpoint.

curl http://localhost:8080/v1/nodes

Ensure to replace the URL with your target Weaviate instance address.

This should return information about the Weaviate node as shown:

{
  "nodes": [
    {
      "batchStats": {
        "queueLength": 0,
        "ratePerSecond": 0
      },
      "gitHash": "6fd2432",
      "name": "5711ac73a53d",
      "shards": null,
      "status": "HEALTHY",
      "version": "1.26.1"
    }
  ]
}

Weaviate Get Node Info – Python

The second and most programmatic method of fetching information about the nodes in Weaviate is using the Python client.

Once you have the Weaviate client installed, create the client and use the code as shown below:

>>> import weaviate
>>> client = weaviate.Client("http://localhost:8080")
>>> nodes_status = client.cluster.get_nodes_status()
>>> print(nodes_status)

And there you have it.

Conclusion

In this post, we explored how to show node information in Weaviate using HTTP endpoints and a Python client.

Share
Comments
More from Cloudenv

Cloudenv

Developer Tips, Tricks and Tutorials.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Cloudenv.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.