Query the information about a cluster

2026-04-02 06:23:57  Updated

This topic describes how to query the information about the OceanBase cluster that contains the OBServer node where OceanBase Shell (obshell) is stored by using obshell-sdk-go.

Note

We recommend that you read Quick start for a better understanding of how to use obshell-sdk-go.

Considerations

Make sure that obshell runs normally.

Sample code

The sample code for synchronous task execution is as follows:

package main

import (
    "github.com/oceanbase/obshell-sdk-go/services"
)

func main() {
    var err error // Handle errors in the production environment.
    
    // Create a client instance, with the IP address of "10.10.10.1" and the port number of 2886.
    // Enter the root@sys password "****" for the cluster.
    client, err := services.NewClientWithPassword("10.10.10.1", 2886, "***")

    // Obtain the information about the OceanBase cluster.
    obInfo, err := client.V1().GetObInfo()
}

References

Contact Us