Skip to content

Commit

Permalink
After failover, allow read requests to failover site even if it has j…
Browse files Browse the repository at this point in the history
…ust read quorum (#51)
  • Loading branch information
krishnasrinivas committed Feb 4, 2021
1 parent f29f267 commit 09c2173
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ func sidekickMain(ctx *cli.Context) {
log.SetReportCaller(true)

healthCheckPath := ctx.GlobalString("health-path")
healthReadCheckPath := ctx.GlobalString("read-health-path")
healthCheckPort := ctx.GlobalInt("health-port")
healthCheckDuration := ctx.GlobalInt("health-duration")
addr := ctx.GlobalString("address")
Expand All @@ -609,8 +610,19 @@ func sidekickMain(ctx *cli.Context) {
healthCheckPath = slashSeparator + healthCheckPath
}

if healthReadCheckPath == "" {
healthReadCheckPath = healthCheckPath
}
if !strings.HasPrefix(healthReadCheckPath, slashSeparator) {
healthReadCheckPath = slashSeparator + healthReadCheckPath
}

var sites []*site
for i, siteStrs := range ctx.Args() {
if i == len(ctx.Args())-1 {
healthCheckPath = healthReadCheckPath
}

site := configureSite(ctx, i+1, strings.Split(siteStrs, ","), healthCheckPath, healthCheckPort, healthCheckDuration)
sites = append(sites, site)
}
Expand Down Expand Up @@ -663,6 +675,10 @@ func main() {
Name: "health-path, p",
Usage: "health check path",
},
cli.StringFlag{
Name: "read-health-path, r",
Usage: "health check path for read access - valid only for failover site",
},
cli.IntFlag{
Name: "health-port",
Usage: "health check port",
Expand Down Expand Up @@ -745,8 +761,13 @@ EXAMPLES:
$ sidekick --health-path=/minio/health/cluster http://site1-minio{1...4}:9000,http://site1-minio{5...8}:9000 \
http://site2-minio{1...4}:9000,http://site2-minio{5...8}:9000
5. Sidekick as TLS terminator:
5. Two sites, each site having two zones, each zone having 4 servers. After failover, allow read requests to site2 even if it has just read quorum:
$ sidekick --health-path=/minio/health/cluster --read-health-path=/minio/health/cluster/read http://site1-minio{1...4}:9000,http://site1-minio{5...8}:9000 \
http://site2-minio{1...4}:9000,http://site2-minio{5...8}:9000
6. Sidekick as TLS terminator:
$ sidekick --cert public.crt --key private.key --health-path=/minio/health/cluster http://site1-minio{1...4}:9000
`
app.Action = sidekickMain
app.Run(os.Args)
Expand Down

0 comments on commit 09c2173

Please sign in to comment.