This topic describes how to query tenant configuration items by using obshell-sdk-go, including specifying and fuzzy matching.
Note
We recommend that you first read obshell-sdk-go quick start to learn how to use obshell-sdk-go.
Query a specified tenant configuration item
Considerations
Make sure that obshell is running.
Make sure that the tenant exists and is in the NORMAL state.
The node corresponding to the client must be in an 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 match tenant configuration items
Considerations
Make sure that obshell is running.
Make sure that the tenant exists and is in the NORMAL state.
The node corresponding to the client must be in an 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 specifying tenant configuration items, see Query a specified tenant configuration item.
For more information about the API for fuzzy matching tenant configuration items, see Fuzzy match tenant configuration items.
For more information about how to request API methods by using obshell-sdk-python, see Query tenant configuration items.