diff options
Diffstat (limited to 'weed/server/filer_server.go')
| -rw-r--r-- | weed/server/filer_server.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/weed/server/filer_server.go b/weed/server/filer_server.go index 8e40b2145..98784bce3 100644 --- a/weed/server/filer_server.go +++ b/weed/server/filer_server.go @@ -50,7 +50,7 @@ import ( ) type FilerOption struct { - Masters map[string]pb.ServerAddress + Masters *pb.ServerDiscovery FilerGroup string Collection string DefaultReplication string @@ -118,11 +118,12 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) } fs.listenersCond = sync.NewCond(&fs.listenersLock) - if len(option.Masters) == 0 { + option.Masters.RefreshBySrvIfAvailable() + if len(option.Masters.GetInstances()) == 0 { glog.Fatal("master list is required!") } - fs.filer = filer.NewFiler(option.Masters, fs.grpcDialOption, option.Host, option.FilerGroup, option.Collection, option.DefaultReplication, option.DataCenter, func() { + fs.filer = filer.NewFiler(*option.Masters, fs.grpcDialOption, option.Host, option.FilerGroup, option.Collection, option.DefaultReplication, option.DataCenter, func() { fs.listenersCond.Broadcast() }) fs.filer.Cipher = option.Cipher @@ -195,7 +196,8 @@ func (fs *FilerServer) checkWithMaster() { isConnected := false for !isConnected { - for _, master := range fs.option.Masters { + fs.option.Masters.RefreshBySrvIfAvailable() + for _, master := range fs.option.Masters.GetInstances() { readErr := operation.WithMasterServerClient(false, master, fs.grpcDialOption, func(masterClient master_pb.SeaweedClient) error { resp, err := masterClient.GetMasterConfiguration(context.Background(), &master_pb.GetMasterConfigurationRequest{}) if err != nil { |
