diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-01-18 14:14:47 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-01-18 14:14:47 -0800 |
| commit | 67e2ea72be5b0f5bb1f69967165a279cc3067938 (patch) | |
| tree | 81c0b0e446222cf3b522a495d2761329aab044b4 /weed/wdclient/masterclient.go | |
| parent | dfae0f4e9df1c1b041d6c4f1f13d885bd86f0e20 (diff) | |
| download | seaweedfs-67e2ea72be5b0f5bb1f69967165a279cc3067938.tar.xz seaweedfs-67e2ea72be5b0f5bb1f69967165a279cc3067938.zip | |
master add separate grpc port
due to https://github.com/soheilhy/cmux/issues/64
fix https://github.com/chrislusf/seaweedfs/issues/820
fix https://github.com/chrislusf/seaweedfs/issues/840
fix https://github.com/chrislusf/seaweedfs/issues/841
Diffstat (limited to 'weed/wdclient/masterclient.go')
| -rw-r--r-- | weed/wdclient/masterclient.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index df0adbd18..f58c28504 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -49,8 +49,9 @@ func (mc *MasterClient) KeepConnectedToMaster() { func (mc *MasterClient) tryAllMasters() { for _, master := range mc.masters { - glog.V(0).Infof("Connecting to %v", master) - withMasterClient(master, func(client master_pb.SeaweedClient) error { + glog.V(0).Infof("Connecting to master %v", master) + gprcErr := withMasterClient(master, func(client master_pb.SeaweedClient) error { + stream, err := client.KeepConnected(context.Background()) if err != nil { glog.V(0).Infof("failed to keep connected to %s: %v", master, err) @@ -88,13 +89,22 @@ func (mc *MasterClient) tryAllMasters() { }) + if gprcErr != nil { + glog.V(0).Infof("%s failed to connect with master %v: %v", mc.name, master, gprcErr) + } + mc.currentMaster = "" } } func withMasterClient(master string, fn func(client master_pb.SeaweedClient) error) error { - grpcConnection, err := util.GrpcDial(master) + masterGrpcAddress, parseErr := util.ParseServerToGrpcAddress(master, 0) + if parseErr != nil { + return fmt.Errorf("failed to parse master grpc %v", master) + } + + grpcConnection, err := util.GrpcDial(masterGrpcAddress) if err != nil { return fmt.Errorf("fail to dial %s: %v", master, err) } |
