mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-22 20:34:10 +08:00
Implement SRV lookups for filer (#4767)
This commit is contained in:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user