This topic describes how to initiate a restore 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 must be in an initialized cluster.
Sample code
package main
import (
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance, where the node address 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().NewRestoreRequest("rt1", "file:///data/backup/data", []v1.ZoneParam{
{
Name: "zone1",
UnitConfigName: "unit1",
UnitNum: 1,
},
})
request.SetArchiveLogUri("file:///data/backup/archive")
_, err = client.V1().RestoreSyncWithRequest(request)
if err != nil {
panic(err)
}
}
References
For more information about the API for initiating a restore for a tenant, see Initiate a restore for a tenant.
For more information about how to request API methods by using obshell-sdk-python, see Initiate a restore for a single tenant.