This topic describes how to initiate a backup for a single tenant by using obshell-sdk-go.
Note
We recommend that you first check out Get started with obshell-sdk-go to learn how to use obshell-sdk-go.
Considerations
Make sure that obshell is running.
The node corresponding to the client in the request must be in an initialized cluster.
Sample code
package main
import (
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance. The IP address of the node is '10.10.10.1', and the port is 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
panic(err)
}
request := client.V1().NewTenantBackupRequest("tenant2")
request.SetBackupMode("full")
_, err = client.V1().TenantBackupSyncWithRequest(request)
if err != nil {
panic(err)
}
}
References
For more information about the API for initiating a backup for a single tenant, see Initiate a backup for a single tenant.
For more information about how to request API methods by using obshell-sdk-python, see Initiate a backup for a single tenant.