Check for advertise host when setting failed peers (#1411)

When setting initially failing peers, if we don't
have a value for the advertise address, use the
bindAddr.

Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
This commit is contained in:
stuart nelson 2018-06-11 14:18:15 +02:00 committed by GitHub
parent ec2cc57d28
commit d259bf9d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -197,6 +197,9 @@ func Join(
if advertiseHost != "" {
cfg.AdvertiseAddr = advertiseHost
cfg.AdvertisePort = advertisePort
p.setInitialFailed(resolvedPeers, fmt.Sprintf("%s:%d", advertiseHost, advertisePort))
} else {
p.setInitialFailed(resolvedPeers, bindAddr)
}
ml, err := memberlist.Create(cfg)
@ -205,8 +208,6 @@ func Join(
}
p.mlist = ml
p.setInitialFailed(resolvedPeers, fmt.Sprintf("%s:%d", advertiseHost, advertisePort))
n, err := ml.Join(resolvedPeers)
if err != nil {
level.Warn(l).Log("msg", "failed to join cluster", "err", err)