This topic describes how to query tenant parameters through the obshell-sdk-go API, including exact query and fuzzy query.
Note
We recommend that you first read through the Quick start section of obshell-sdk-go to understand how to use it.
Query specific tenant parameters
Considerations
Ensure that obshell is running normally.
Ensure the specified tenant exists and its status is NORMAL.
The node corresponding to the requesting client must be part of the initialized cluster.
Sample code
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance with the node address '10.10.10.1' and port 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
value, err := client.V1().GetTenantParameter("t1", "arbitration_timeout")
if err != nil {
fmt.Print(err)
return
}
fmt.Print(value)
}
Fuzzy query for tenant parameters
Considerations
Ensure that obshell is running normally.
Ensure the specified tenant exists and its status is NORMAL.
The node corresponding to the requesting client must be part of the initialized cluster.
Sample code
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance with the node address '10.10.10.1' and port 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
parameter, err := client.V1().GetTenantParameters("t1", "max_partition%")
if err != nil {
fmt.Print(err)
return
}
fmt.Print(parameter)
}
References
For more information about the API for querying specific tenant parameters, see Query specific tenant parameters.
For more information about the API for fuzzy querying tenant parameters, see Fuzzy query for tenant parameters.
For more information about how to request the API using obshell-sdk-python, see Query tenant parameters.
