Skip to content

Commit

Permalink
Update galera arbitrator helper methods and constants (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
shudipta authored and tamalsaha committed Aug 9, 2019
1 parent ee40af4 commit 598495b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions apis/config/v1alpha1/galera_arbitrator_config_helper.go
Expand Up @@ -18,14 +18,7 @@ const (
// GarbdLogFile is the name log file at which Galera Arbitrator Daemon (garbd) puts logs
GarbdLogFile = "/tmp/garb.log"

// GaleraParamsGarbdListenAddr defines an arbitrary listen socket address
// that Galera Arbitrator Daemon (garbd) opens to communicate with the cluster
// https://galeracluster.com/library/documentation/backup-cluster.html
GaleraParamsGarbdListenAddr = "gmcast.listen_addr=tcp://0.0.0.0:" + string(GarbdListenPort)

// SOCAT is needed after completing sst by Galera Arbitrator (garbd)
// SOCATOptionTCPLISTEN is the SOCAT tcp listen option
SOCATOptionTCPLISTEN = "TCP-LISTEN:" + string(GarbdListenPort)
// SOCAT is needed after completing sst by Galera Arbitrator Daemon (garbd)
// SOCATOptionReUseAddr is the SOCAT reuseaddr option
SOCATOptionReUseAddr = "reuseaddr"
// SOCATOptionRetry is the default retry value for `socat` binary
Expand All @@ -35,12 +28,15 @@ const (
// ClusterAddressWithListenOption method returns the galera cluster address with
// the listening option (address at which Galera Cluster listens to connections from
// other nodes) for `--address` option in `garbd`
// Here, ‘?gmcast.listen_addr=tcp://0.0.0.0:4444‘ is an arbitrary listen socket address
// that Galera Arbitrator opens to communicate with the cluster.
// https://galeracluster.com/library/documentation/backup-cluster.html
func (g *GaleraArbitratorConfiguration) ClusterAddressWithListenOption() string {
if g == nil {
return ""
}

return fmt.Sprintf("%s?%s", g.Address, GaleraParamsGarbdListenAddr)
return fmt.Sprintf("%s?gmcast.listen_addr=tcp://0.0.0.0:%d", g.Address, GarbdListenPort)
}

// SSTRequestString method form the sst request string
Expand All @@ -56,5 +52,5 @@ func (g *GaleraArbitratorConfiguration) SSTRequestString(host string) string {
// SOCATOption returns the option string used for `SOCAT` in the
// percona xtradb backup process
func SOCATOption(retry int32) string {
return fmt.Sprintf("%s,%s,retry=%d", SOCATOptionTCPLISTEN, SOCATOptionReUseAddr, retry)
return fmt.Sprintf("TCP-LISTEN:%d,%s,retry=%d", GarbdListenPort, SOCATOptionReUseAddr, retry)
}

0 comments on commit 598495b

Please sign in to comment.