This topic describes how to query tenant parameters 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 parameter
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 parameters
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 parameters, see Query a specified tenant parameter.
For more information about the API for fuzzy matching tenant parameters, see Fuzzy match tenant parameters.
For more information about how to request API methods by using obshell-sdk-python, see Query tenant parameters.