diff options
| author | Lei Liu <lei01.liu@horizon.ai> | 2019-11-12 14:21:43 +0800 |
|---|---|---|
| committer | Lei Liu <lei01.liu@horizon.ai> | 2019-11-12 14:46:10 +0800 |
| commit | 46755ea1e1e4d79e4c0368aa7fcb17ee8aa812cc (patch) | |
| tree | 616583cdfdd2803465345fee4ee4cdbcba5f72aa /weed/server/master_server.go | |
| parent | ee90236a972acea8722dccfa1b04926d551fc82d (diff) | |
| download | seaweedfs-46755ea1e1e4d79e4c0368aa7fcb17ee8aa812cc.tar.xz seaweedfs-46755ea1e1e4d79e4c0368aa7fcb17ee8aa812cc.zip | |
fix master maintenance logic
Signed-off-by: Lei Liu <lei01.liu@horizon.ai>
Diffstat (limited to 'weed/server/master_server.go')
| -rw-r--r-- | weed/server/master_server.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 15e6ee51c..e68356c01 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -182,16 +182,21 @@ func (ms *MasterServer) proxyToLeader(f func(w http.ResponseWriter, r *http.Requ } func (ms *MasterServer) startAdminScripts() { + var err error + v := viper.GetViper() adminScripts := v.GetString("master.maintenance.scripts") - v.SetDefault("master.maintenance.sleep_minutes", 17) - sleepMinutes := v.GetInt("master.maintenance.sleep_minutes") - glog.V(0).Infof("adminScripts:\n%v", adminScripts) if adminScripts == "" { return } + 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") + scriptLines := strings.Split(adminScripts, "\n") masterAddress := "localhost:" + strconv.Itoa(ms.option.Port) @@ -199,9 +204,12 @@ func (ms *MasterServer) startAdminScripts() { var shellOptions shell.ShellOptions shellOptions.GrpcDialOption = security.LoadClientTLS(viper.Sub("grpc"), "master") shellOptions.Masters = &masterAddress - shellOptions.FilerHost = "localhost" - shellOptions.FilerPort = 8888 - shellOptions.Directory = "/" + + 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) + return + } commandEnv := shell.NewCommandEnv(shellOptions) |
