sunty
2020-04-17 f4c1ad199cdd31a454a60e50661db0de1747977a
tools/middleware/middleware.go
@@ -31,6 +31,7 @@
   }
   script.ReplaceLineContentBySearch(config.Option+config.StartScriptAsVolume, config.Option, config.Server.ScriptPath, config.StartServerScript)
   script.ReplaceLineContentBySearch(es.GetNewPeers(), config.Peer, config.Server.ScriptPath, config.StartServerScript)
   script.StopServer(config.Server.ScriptPath)
   script.StartServer(config.Server.ScriptPath)
   return true
}
@@ -113,12 +114,15 @@
   case config.StartScriptAsVolume:
      verificationVolumeUrl := "http://" + ip + ":6700/ui/index.html"
      _, volume1Err := http.Get(verificationVolumeUrl)
      fmt.Println("volume1Err", volume1Err)
      if volume1Err == nil {
         resStatu = true
      }
   case config.StartScriptAsMaster:
      verificationMasterUrl := "http://" + ip + ":6333"
      fmt.Println("verificationMasterUrl: ", verificationMasterUrl)
      _, masterErr := http.Get(verificationMasterUrl)
      fmt.Println("masterErr", masterErr)
      if masterErr == nil {
         resStatu = true
      }
@@ -155,13 +159,13 @@
      fmt.Println("重启当前组服务" + ip)
      if (i+1)%coreThread == 0 {
         masterIp = append(masterIp, strings.Split(ip, ":")[0])
         fmt.Println("加入第一组并开始验证第一组 masterIp: ", masterIp)
         fmt.Println("验证当前组 masterIp 成员: ", masterIp)
         for i := 0; i < len(masterIp); i++ {
            fmt.Println("len masterIp: ", len(masterIp))
            fmt.Println("第" + strconv.Itoa(i) + "个线程")
            fmt.Println("当前goroutinebe")
            //fmt.Println("当前goroutinebe")
            waitGroup.Add(1) //每创建一个goroutine,就把任务队列中任务的数量+1
            fmt.Println("当前goroutineaf")
            //fmt.Println("当前goroutineaf")
            go Restart(masterIp[i], timeOut)
            waitGroup.Done()
         }
@@ -184,7 +188,6 @@
            break
         }
      }
   }
   fmt.Println("服务流程执行完毕")