fix resync to find peers by deployment ID instead of site names (#4884)

The site names may vary if configured on UI. The Deployment ID
is immutable and can be used instead in replicate resync commands.
This commit is contained in:
Praveen raj Mani
2024-03-25 09:41:14 -07:00
committed by GitHub
parent 9043bbf545
commit 7bac47fe04
3 changed files with 20 additions and 5 deletions
+6 -1
View File
@@ -92,9 +92,14 @@ func mainAdminReplicateResyncCancel(ctx *cli.Context) error {
fatalIf(err, "Unable to initialize admin connection.")
info, e := client.SiteReplicationInfo(globalContext)
fatalIf(probe.NewError(e), "Unable to fetch site replication info.")
peerClient := getClient(args.Get(1))
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
var peer madmin.PeerInfo
for _, site := range info.Sites {
if args[1] == site.Name {
if peerAdmInfo.DeploymentID == site.DeploymentID {
peer = site
}
}
+8 -3
View File
@@ -87,15 +87,20 @@ func mainAdminReplicateResyncStart(ctx *cli.Context) error {
// Get the alias parameter from cli
args := ctx.Args()
aliasedURL := args.Get(0)
// Create a new MinIO Admin Client
client, err := newAdminClient(aliasedURL)
client, err := newAdminClient(args.Get(0))
fatalIf(err, "Unable to initialize admin connection.")
info, e := client.SiteReplicationInfo(globalContext)
fatalIf(probe.NewError(e), "Unable to fetch site replication info.")
peerClient := getClient(args.Get(1))
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
var peer madmin.PeerInfo
for _, site := range info.Sites {
if args[1] == site.Name {
if peerAdmInfo.DeploymentID == site.DeploymentID {
peer = site
}
}
+6 -1
View File
@@ -86,9 +86,14 @@ func mainAdminReplicationResyncStatus(ctx *cli.Context) error {
console.Colorize("ResyncMessage", "SiteReplication is not enabled")
return nil
}
peerClient := getClient(args.Get(1))
peerAdmInfo, e := peerClient.ServerInfo(globalContext)
fatalIf(probe.NewError(e), "Unable to fetch server info of the peer.")
var peer madmin.PeerInfo
for _, site := range info.Sites {
if args[1] == site.Name {
if peerAdmInfo.DeploymentID == site.DeploymentID {
peer = site
}
}