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
disk type configurable for each folder
Chris Luf6a419c26caf
diff --git a/weed/command/volume.go b/weed/command/volume.goindex 02d8eb50c9..b90dc5967d 100644--- a/weed/command/volume.go+++ b/weed/command/volume.go@@ -169,6 +169,25 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, vglog.Fatalf("%d directories by -dir, but only %d minFreeSpacePercent is set by -minFreeSpacePercent", len(v.folders), len(v.minFreeSpacePercents))}+ // set disk types+ var diskTypes []storage.DiskType+ diskTypeStrings := strings.Split(*v.diskType, ",")+ for _, diskTypeString := range diskTypeStrings {+ if diskType, err := storage.ToDiskType(diskTypeString); err == nil {+ diskTypes = append(diskTypes, diskType)+ } else {+ glog.Fatalf("failed to parse volume type: %v", err)+ }+ }+ if len(diskTypes) == 1 && len(v.folders) > 1 {+ for i := 0; i < len(v.folders)-1; i++ {+ diskTypes = append(diskTypes, diskTypes[0])+ }+ }+ if len(v.folders) != len(diskTypes) {+ glog.Fatalf("%d directories by -dir, but only %d disk types is set by -disk", len(v.folders), len(diskTypes))+ }+// security related white list configurationif volumeWhiteListOption != "" {v.whiteList = strings.Split(volumeWhiteListOption, ",")@@ -212,14 +231,9 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, vmasters := *v.masters- diskType, err := storage.ToDiskType(*v.diskType)- if err != nil {- glog.Fatalf("failed to parse volume type: %v", err)- }-volumeServer := weed_server.NewVolumeServer(volumeMux, publicVolumeMux,*v.ip, *v.port, *v.publicUrl,- v.folders, v.folderMaxLimits, v.minFreeSpacePercents, diskType,+ v.folders, v.folderMaxLimits, v.minFreeSpacePercents, diskTypes,*v.idxFolder,volumeNeedleMapKind,strings.Split(masters, ","), 5, *v.dataCenter, *v.rack,diff --git a/weed/server/volume_server.go b/weed/server/volume_server.goindex f88c84184a..7c731763b2 100644--- a/weed/server/volume_server.go+++ b/weed/server/volume_server.go@@ -20,7 +20,6 @@ type VolumeServer struct {pulseSeconds intdataCenter stringrack string- DiskType storage.DiskTypestore *storage.Storeguard *security.GuardgrpcDialOption grpc.DialOption@@ -38,7 +37,7 @@ type VolumeServer struct {func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,port int, publicUrl string,- folders []string, maxCounts []int, minFreeSpacePercents []float32, diskType storage.DiskType,+ folders []string, maxCounts []int, minFreeSpacePercents []float32, diskTypes []storage.DiskType,idxFolder string,needleMapKind storage.NeedleMapType,masterNodes []string, pulseSeconds int,@@ -64,7 +63,6 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,pulseSeconds: pulseSeconds,dataCenter: dataCenter,rack: rack,- DiskType: diskType,needleMapKind: needleMapKind,FixJpgOrientation: fixJpgOrientation,ReadRedirect: readRedirect,@@ -78,7 +76,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,vs.checkWithMaster()- vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercents, idxFolder, vs.needleMapKind, vs.DiskType)+ vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercents, idxFolder, vs.needleMapKind, diskTypes)vs.guard = security.NewGuard(whiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec)handleStaticResources(adminMux)diff --git a/weed/storage/store.go b/weed/storage/store.goindex 1b1c771df5..fc524876dd 100644--- a/weed/storage/store.go+++ b/weed/storage/store.go@@ -52,11 +52,11 @@ func (s *Store) String() (str string) {return}-func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, minFreeSpacePercents []float32, idxFolder string, needleMapKind NeedleMapType, diskType DiskType) (s *Store) {+func NewStore(grpcDialOption grpc.DialOption, port int, ip, publicUrl string, dirnames []string, maxVolumeCounts []int, minFreeSpacePercents []float32, idxFolder string, needleMapKind NeedleMapType, diskTypes []DiskType) (s *Store) {s = &Store{grpcDialOption: grpcDialOption, Port: port, Ip: ip, PublicUrl: publicUrl, NeedleMapType: needleMapKind}s.Locations = make([]*DiskLocation, 0)for i := 0; i < len(dirnames); i++ {- location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], minFreeSpacePercents[i], idxFolder, diskType)+ location := NewDiskLocation(dirnames[i], maxVolumeCounts[i], minFreeSpacePercents[i], idxFolder, diskTypes[i])location.loadExistingVolumes(needleMapKind)s.Locations = append(s.Locations, location)stats.VolumeServerMaxVolumeCounter.Add(float64(maxVolumeCounts[i]))