MM-16400: Adding more control over bind and advertising address in cluster configuration (#11283)

Этот коммит содержится в:
Jesús Espino
2019-06-26 09:40:19 +02:00
коммит произвёл GitHub
родитель 8f0216c57f
Коммит e53dba3848
3 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@@ -46,10 +46,14 @@ func (o *ClusterDiscovery) AutoFillHostname() {
} }
} }
func (o *ClusterDiscovery) AutoFillIpAddress(iface string) { func (o *ClusterDiscovery) AutoFillIpAddress(iface string, ipAddress string) {
// attempt to set the hostname to the first non-local IP address // attempt to set the hostname to the first non-local IP address
if len(o.Hostname) == 0 { if len(o.Hostname) == 0 {
o.Hostname = GetServerIpAddress(iface) if len(ipAddress) > 0 {
o.Hostname = ipAddress
} else {
o.Hostname = GetServerIpAddress(iface)
}
} }
} }

Просмотреть файл

@@ -53,7 +53,7 @@ func TestClusterDiscovery(t *testing.T) {
o.Hostname = "" o.Hostname = ""
o.AutoFillHostname() o.AutoFillHostname()
o.AutoFillIpAddress("") o.AutoFillIpAddress("", "")
o.Hostname = "" o.Hostname = ""
o.AutoFillIpAddress("") o.AutoFillIpAddress("", "")
} }

Просмотреть файл

@@ -673,6 +673,8 @@ type ClusterSettings struct {
ClusterName *string `restricted:"true"` ClusterName *string `restricted:"true"`
OverrideHostname *string `restricted:"true"` OverrideHostname *string `restricted:"true"`
NetworkInterface *string `restricted:"true"` NetworkInterface *string `restricted:"true"`
BindAddress *string `restricted:"true"`
AdvertiseAddress *string `restricted:"true"`
UseIpAddress *bool `restricted:"true"` UseIpAddress *bool `restricted:"true"`
UseExperimentalGossip *bool `restricted:"true"` UseExperimentalGossip *bool `restricted:"true"`
ReadOnlyConfig *bool `restricted:"true"` ReadOnlyConfig *bool `restricted:"true"`
@@ -700,6 +702,14 @@ func (s *ClusterSettings) SetDefaults() {
s.NetworkInterface = NewString("") s.NetworkInterface = NewString("")
} }
if s.BindAddress == nil {
s.BindAddress = NewString("")
}
if s.AdvertiseAddress == nil {
s.AdvertiseAddress = NewString("")
}
if s.UseIpAddress == nil { if s.UseIpAddress == nil {
s.UseIpAddress = NewBool(true) s.UseIpAddress = NewBool(true)
} }