fail fast if filer configured wrong masters

fix https://github.com/chrislusf/seaweedfs/issues/1257
This commit is contained in:
Chris Lu 2020-04-03 00:47:33 -07:00
parent aaf5e658cc
commit 4a5e381feb

View file

@ -11,6 +11,7 @@ import (
"google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/stats"
@ -58,7 +59,6 @@ type FilerServer struct {
// notifying clients
clientChansLock sync.RWMutex
clientChans map[string]chan *filer_pb.FullEventNotification
}
func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) (fs *FilerServer, err error) {
@ -117,6 +117,14 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
}
func maybeStartMetrics(fs *FilerServer, option *FilerOption) {
for _, master := range option.Masters {
_, err := pb.ParseFilerGrpcAddress(master)
if err != nil {
glog.Fatalf("invalid master address %s: %v", master, err)
}
}
isConnected := false
var metricsAddress string
var metricsIntervalSec int