aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-03-11 16:36:43 -0800
committerChris Lu <chris.lu@gmail.com>2021-03-11 16:36:43 -0800
commit40dc5ac90470efcd913b9aebe0ab25487ad0cae5 (patch)
tree3a18c6623926f0766a5d14ef4466ac8081d6e6db
parentaba47fd9e83fa1e297199fd10518289237e3bf26 (diff)
downloadseaweedfs-40dc5ac90470efcd913b9aebe0ab25487ad0cae5.tar.xz
seaweedfs-40dc5ac90470efcd913b9aebe0ab25487ad0cae5.zip
mount: add a bit retry when connecting to filer during startup
-rw-r--r--weed/command/mount_std.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.go
index 6eb836311..8da69d0ac 100644
--- a/weed/command/mount_std.go
+++ b/weed/command/mount_std.go
@@ -63,16 +63,23 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
// try to connect to filer, filerBucketsPath may be useful later
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")
var cipher bool
- err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
- resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
+ for i := 0; i < 10; i++ {
+ err = pb.WithGrpcFilerClient(filerGrpcAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
+ resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
+ if err != nil {
+ return fmt.Errorf("get filer grpc address %s configuration: %v", filerGrpcAddress, err)
+ }
+ cipher = resp.Cipher
+ return nil
+ })
if err != nil {
- return fmt.Errorf("get filer grpc address %s configuration: %v", filerGrpcAddress, err)
+ glog.V(0).Infof("failed to talk to filer %s: %v", filerGrpcAddress, err)
+ glog.V(0).Infof("wait for %d seconds ...", i+1)
+ time.Sleep(time.Duration(i+1)*time.Second)
}
- cipher = resp.Cipher
- return nil
- })
+ }
if err != nil {
- glog.Infof("failed to talk to filer %s: %v", filerGrpcAddress, err)
+ glog.Errorf("failed to talk to filer %s: %v", filerGrpcAddress, err)
return true
}