feat(bootstrap): initial working code

This is an initial version of the bootstrap code that seems to work
under the normal circumstances. I need to mock out a server that will
test out all of the error cases now.
This commit is contained in:
Brandon Philips
2014-01-29 08:21:23 -08:00
parent 40a8542c22
commit 72514f8ab2
8 changed files with 310 additions and 158 deletions

View File

@@ -209,7 +209,7 @@ func (s *PeerServer) startAsFollower(cluster []string) {
if ok {
return
}
log.Warnf("cannot join to cluster via given peers, retry in %d seconds", retryInterval)
log.Warnf("Unable to join the cluster using any of the peers %v. Retrying in %d seconds", cluster, retryInterval)
time.Sleep(time.Second * retryInterval)
}
@@ -266,17 +266,18 @@ func (s *PeerServer) joinCluster(cluster []string) bool {
err := s.joinByPeer(s.raftServer, peer, s.Config.Scheme)
if err == nil {
log.Debugf("%s success join to the cluster via peer %s", s.Config.Name, peer)
log.Debugf("%s joined the cluster via peer %s", s.Config.Name, peer)
return true
} else {
if _, ok := err.(etcdErr.Error); ok {
log.Fatal(err)
}
log.Debugf("cannot join to cluster via peer %s %s", peer, err)
}
if _, ok := err.(etcdErr.Error); ok {
log.Fatal(err)
}
log.Warnf("Attempt to join via %s failed: %s", peer, err)
}
return false
}