SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
mount: fail fast when connecting to filer
Chris Lub1f377f8227e
diff --git a/weed/command/mount_std.go b/weed/command/mount_std.goindex ba7fb852bf..1e6444ae1f 100644--- a/weed/command/mount_std.go+++ b/weed/command/mount_std.go@@ -3,6 +3,7 @@package commandimport (+ "context""fmt""os""os/user"@@ -16,6 +17,7 @@ import ("github.com/chrislusf/seaweedfs/weed/filesys""github.com/chrislusf/seaweedfs/weed/glog"+ "github.com/chrislusf/seaweedfs/weed/pb/filer_pb""github.com/chrislusf/seaweedfs/weed/security""github.com/chrislusf/seaweedfs/weed/util""github.com/seaweedfs/fuse"@@ -131,6 +133,7 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCentec.Close()})+ // parse filer grpc addressfilerGrpcAddress, err := parseFilerGrpcAddress(filer)if err != nil {glog.V(0).Infof("parseFilerGrpcAddress: %v", err)@@ -138,6 +141,23 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCentereturn true}+ // try to connect to filer, filerBucketsPath may be useful later+ filerBucketsPath := "/buckets"+ grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client")+ err = withFilerClient(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 %s configuration: %v", filerGrpcAddress, err)+ }+ filerBucketsPath = resp.DirBuckets+ return nil+ })+ if err != nil {+ glog.Fatal(err)+ return false+ }++ // find mount pointmountRoot := filerMountRootPathif mountRoot != "/" && strings.HasSuffix(mountRoot, "/") {mountRoot = mountRoot[0 : len(mountRoot)-1]@@ -147,7 +167,7 @@ func RunMount(filer, filerMountRootPath, dir, collection, replication, dataCenteerr = fs.Serve(c, filesys.NewSeaweedFileSystem(&filesys.Option{FilerGrpcAddress: filerGrpcAddress,- GrpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.client"),+ GrpcDialOption: grpcDialOption,FilerMountRootPath: mountRoot,Collection: collection,Replication: replication,