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
move from cmd-line to scaffold
stlpmo802a0eb3fe11
diff --git a/weed/command/master.go b/weed/command/master.goindex 55e3409ed8..d4c2b9b167 100644--- a/weed/command/master.go+++ b/weed/command/master.go@@ -37,9 +37,6 @@ type MasterOptions struct {disableHttp *boolmetricsAddress *stringmetricsIntervalSec *int-- sequencerType *string- etcdUrls *string}func init() {@@ -58,9 +55,6 @@ func init() {m.disableHttp = cmdMaster.Flag.Bool("disableHttp", false, "disable http requests, only gRPC operations are allowed.")m.metricsAddress = cmdMaster.Flag.String("metrics.address", "", "Prometheus gateway address")m.metricsIntervalSec = cmdMaster.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")- m.sequencerType = cmdMaster.Flag.String("sequencerType", "memory", "Choose [memory|etcd] type for store the file sequence")- m.etcdUrls = cmdMaster.Flag.String("etcdUrls", "",- "when sequencerType=etcd, set etcdUrls for etcd cluster that store file sequence, example : http://127.0.0.1:2379,http://127.0.0.1:2389")}var cmdMaster = &Command{@@ -84,6 +78,7 @@ func runMaster(cmd *Command, args []string) bool {util.LoadConfiguration("security", false)util.LoadConfiguration("master", false)+ glog.V(0).Infof("%v", viper.GetViper().GetString("master.maintenance.scripts"))runtime.GOMAXPROCS(runtime.NumCPU())util.SetupProfiling(*masterCpuProfile, *masterMemProfile)diff --git a/weed/command/scaffold.go b/weed/command/scaffold.goindex 7a988cdcf2..9b266a69d9 100644--- a/weed/command/scaffold.go+++ b/weed/command/scaffold.go@@ -346,5 +346,12 @@ scripts = """"""sleep_minutes = 17 # sleep minutes between each script execution+sequencer.type = memory # Choose [memory|etcd] type for storing the file id sequence++# when sequencer.type = etcd, set listen client urls of etcd cluster that store file id sequence+# example : http://127.0.0.1:2379,http://127.0.0.1:2389+sequencer.etcd.urls = http://127.0.0.1:2379++`)diff --git a/weed/server/master_server.go b/weed/server/master_server.goindex fd3236c53b..41764c2e7b 100644--- a/weed/server/master_server.go+++ b/weed/server/master_server.go@@ -27,6 +27,12 @@ import ("google.golang.org/grpc")+const (+ MasterPrefix = "master.maintenance."+ SequencerType = MasterPrefix + "sequencer_type"+ SequencerEtcdUrls = MasterPrefix + "sequencer_etcd_urls"+)+type MasterOption struct {Port intMetaFolder string@@ -39,9 +45,6 @@ type MasterOption struct {DisableHttp boolMetricsAddress stringMetricsIntervalSec int-- sequencerType string- etcdUrls string}type MasterServer struct {@@ -172,8 +175,8 @@ func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Requproxy.Transport = util.Transportproxy.ServeHTTP(w, r)} else {- //drop it to the floor- //writeJsonError(w, r, errors.New(ms.Topo.RaftServer.Name()+" does not know Leader yet:"+ms.Topo.RaftServer.Leader()))+ // drop it to the floor+ // writeJsonError(w, r, errors.New(ms.Topo.RaftServer.Name()+" does not know Leader yet:"+ms.Topo.RaftServer.Leader()))}}}@@ -240,13 +243,16 @@ func (ms *MasterServer) startAdminScripts() {func (ms *MasterServer) createSequencer(option *MasterOption) sequence.Sequencer {var seq sequence.Sequencer- glog.V(0).Infof("sequencer type [%s]", option.sequencerType)- switch strings.ToLower(option.sequencerType) {+ seqType := strings.ToLower(util.Config().GetString(SequencerType))+ glog.V(0).Infof("sequencer type [%s]", seqType)+ switch strings.ToLower(seqType) {case "memory":seq = sequence.NewMemorySequencer()case "etcd":var err error- seq, err = sequence.NewEtcdSequencer(option.etcdUrls, option.MetaFolder)+ urls := util.Config().GetString(SequencerEtcdUrls)+ glog.V(4).Infof("ETCD urls : %s", urls)+ seq, err = sequence.NewEtcdSequencer(urls, option.MetaFolder)if err != nil {glog.Error(err)seq = nildiff --git a/weed/util/config.go b/weed/util/config.goindex 1ea833d1f9..f519552633 100644--- a/weed/util/config.go+++ b/weed/util/config.go@@ -40,5 +40,15 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) {}return true+}+func Config() Configuration {+ return viper.GetViper()}++func SubConfig(subKey string) Configuration {+ if subKey != "" {+ return viper.GetViper().Sub(subKey)+ }+ return viper.GetViper()+}\ No newline at end of file