aboutsummaryrefslogtreecommitdiff
path: root/weed/command
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
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')
-rw-r--r--weed/command/master.go8
-rw-r--r--weed/command/server.go1
2 files changed, 6 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")
diff --git a/weed/command/server.go b/weed/command/server.go
index 7efc45475..1b2aada23 100644
--- a/weed/command/server.go
+++ b/weed/command/server.go
@@ -81,6 +81,7 @@ func init() {
masterOptions.garbageThreshold = cmdServer.Flag.Float64("garbageThreshold", 0.3, "threshold to vacuum and reclaim spaces")
masterOptions.metricsAddress = cmdServer.Flag.String("metrics.address", "", "Prometheus gateway address")
masterOptions.metricsIntervalSec = cmdServer.Flag.Int("metrics.intervalSeconds", 15, "Prometheus push interval in seconds")
+ masterOptions.raftResumeState = cmdMaster.Flag.Bool("resumeState", false, "resume previous state on start master server")
filerOptions.collection = cmdServer.Flag.String("filer.collection", "", "all data will be stored in this collection")
filerOptions.port = cmdServer.Flag.Int("filer.port", 8888, "filer server http listen port")