diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go index 76b244a05..ed7df359a 100644 --- a/weed/command/scaffold.go +++ b/weed/command/scaffold.go @@ -346,10 +346,11 @@ scripts = """ """ sleep_minutes = 17 # sleep minutes between each script execution -filer_url = "http://localhost:8888/" - -sequencer_type = memory # Choose [memory|etcd] type for storing the file id sequence +[master.filer] +default_filer_url = "http://localhost:8888/" +[master.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.go index e68356c01..33a5129da 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -28,9 +28,8 @@ import ( ) const ( - MasterPrefix = "master.maintenance" - SequencerType = MasterPrefix + ".sequencer_type" - SequencerEtcdUrls = MasterPrefix + ".sequencer_etcd_urls" + SequencerType = "master.sequencer.type" + SequencerEtcdUrls = "master.sequencer.sequencer_etcd_urls" ) type MasterOption struct { @@ -194,8 +193,8 @@ func (ms *MasterServer) startAdminScripts() { v.SetDefault("master.maintenance.sleep_minutes", 17) sleepMinutes := v.GetInt("master.maintenance.sleep_minutes") - v.SetDefault("master.maintenance.filer_url", "http://localhost:8888/") - filerURL := v.GetString("master.maintenance.filer_url") + v.SetDefault("master.filer.default_filer_url", "http://localhost:8888/") + filerURL := v.GetString("master.filer.default_filer_url") scriptLines := strings.Split(adminScripts, "\n") @@ -207,7 +206,7 @@ func (ms *MasterServer) startAdminScripts() { shellOptions.FilerHost, shellOptions.FilerPort, shellOptions.Directory, err = util.ParseFilerUrl(filerURL) if err != nil { - glog.V(0).Infof("failed to parse master.maintenance.filer_url=%s : %v\n", filerURL, err) + glog.V(0).Infof("failed to parse master.filer.default_filer_urll=%s : %v\n", filerURL, err) return } @@ -251,14 +250,13 @@ func (ms *MasterServer) startAdminScripts() { func (ms *MasterServer) createSequencer(option *MasterOption) sequence.Sequencer { var seq sequence.Sequencer - seqType := strings.ToLower(util.Config().GetString(SequencerType)) - glog.V(0).Infof("[%s] : [%s]", SequencerType, seqType) + v := viper.GetViper() + seqType := strings.ToLower(v.GetString(SequencerType)) + glog.V(1).Infof("[%s] : [%s]", SequencerType, seqType) switch strings.ToLower(seqType) { - case "memory": - seq = sequence.NewMemorySequencer() case "etcd": var err error - urls := util.Config().GetString(SequencerEtcdUrls) + urls := v.GetString(SequencerEtcdUrls) glog.V(0).Infof("[%s] : [%s]", SequencerEtcdUrls, urls) seq, err = sequence.NewEtcdSequencer(urls, option.MetaFolder) if err != nil { diff --git a/weed/util/config.go b/weed/util/config.go index 0ace53a37..84f146bc8 100644 --- a/weed/util/config.go +++ b/weed/util/config.go @@ -41,7 +41,3 @@ func LoadConfiguration(configFileName string, required bool) (loaded bool) { return true } - -func Config() Configuration { - return viper.GetViper() -}