aboutsummaryrefslogtreecommitdiff
path: root/weed/command/master.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-10-03 10:38:47 -0700
committerGitHub <noreply@github.com>2020-10-03 10:38:47 -0700
commit95ffed87c0556a9f314fbd6630fc610f3d082c3e (patch)
tree428f936d5af120adcb37f55796079c9554ab4cf0 /weed/command/master.go
parentf781cce500aabacb4e33abaca3e09d9bb8abf522 (diff)
parent6fbfe7368364e2bd5ecf2e1533a389edd839d1f6 (diff)
downloadseaweedfs-95ffed87c0556a9f314fbd6630fc610f3d082c3e.tar.xz
seaweedfs-95ffed87c0556a9f314fbd6630fc610f3d082c3e.zip
Merge pull request #1505 from ustuzhanin/remove_raft_state
Resume raft state
Diffstat (limited to 'weed/command/master.go')
-rw-r--r--weed/command/master.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/command/master.go b/weed/command/master.go
index 144962f63..a42983259 100644
--- a/weed/command/master.go
+++ b/weed/command/master.go
@@ -41,6 +41,7 @@ type MasterOptions struct {
disableHttp *bool
metricsAddress *string
metricsIntervalSec *int
+ raftResumeState *bool
}
func init() {
@@ -59,6 +60,7 @@ 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 <host>:<port>")
m.metricsIntervalSec = cmdMaster.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
+ m.raftResumeState = cmdMaster.Flag.Bool("resumeState", false, "resume previous state on start master server")
}
var cmdMaster = &Command{
@@ -118,10 +120,10 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {
glog.Fatalf("Master startup error: %v", e)
}
// start raftServer
- raftServer := weed_server.NewRaftServer(security.LoadClientTLS(util.GetViper(), "grpc.master"),
- peers, myMasterAddress, util.ResolvePath(*masterOption.metaFolder), ms.Topo, 5)
+ raftServer, err := weed_server.NewRaftServer(security.LoadClientTLS(util.GetViper(), "grpc.master"),
+ peers, myMasterAddress, util.ResolvePath(*masterOption.metaFolder), ms.Topo, 5, *masterOption.raftResumeState)
if raftServer == nil {
- glog.Fatalf("please verify %s is writable, see https://github.com/chrislusf/seaweedfs/issues/717", *masterOption.metaFolder)
+ glog.Fatalf("please verify %s is writable, see https://github.com/chrislusf/seaweedfs/issues/717: %s", *masterOption.metaFolder, err)
}
ms.SetRaftServer(raftServer)
r.HandleFunc("/cluster/status", raftServer.StatusHandler).Methods("GET")