aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_server.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-09-17 10:29:32 +0800
committerGitHub <noreply@github.com>2020-09-17 10:29:32 +0800
commitf71f7fcf99ba6d64bfa49fd7411e06bdc2b9d591 (patch)
treee0e98625edaab040eed21fd1a8b277f2c0546ad3 /weed/server/volume_server.go
parent23baa3c36ce468a36d89abae59f4411cdc446043 (diff)
parent5eee4983f36f55a2a01381e8af278b28919dbe90 (diff)
downloadseaweedfs-f71f7fcf99ba6d64bfa49fd7411e06bdc2b9d591.tar.xz
seaweedfs-f71f7fcf99ba6d64bfa49fd7411e06bdc2b9d591.zip
Merge pull request #15 from chrislusf/master
sync
Diffstat (limited to 'weed/server/volume_server.go')
-rw-r--r--weed/server/volume_server.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go
index 6612e9045..c600da21e 100644
--- a/weed/server/volume_server.go
+++ b/weed/server/volume_server.go
@@ -31,7 +31,8 @@ type VolumeServer struct {
MetricsAddress string
MetricsIntervalSec int
fileSizeLimitBytes int64
- SendHeartbeat bool
+ isHeartbeating bool
+ stopChan chan bool
}
func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
@@ -67,9 +68,13 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.volume"),
compactionBytePerSecond: int64(compactionMBPerSecond) * 1024 * 1024,
fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,
- SendHeartbeat: true,
+ isHeartbeating: true,
+ stopChan: make(chan bool),
}
vs.SeedMasterNodes = masterNodes
+
+ vs.checkWithMaster()
+
vs.store = storage.NewStore(vs.grpcDialOption, port, ip, publicUrl, folders, maxCounts, minFreeSpacePercents, vs.needleMapKind)
vs.guard = security.NewGuard(whiteList, signingKey, expiresAfterSec, readSigningKey, readExpiresAfterSec)
@@ -93,10 +98,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
go vs.heartbeat()
hostAddress := fmt.Sprintf("%s:%d", ip, port)
- go stats.LoopPushingMetric("volumeServer", hostAddress, stats.VolumeServerGather,
- func() (addr string, intervalSeconds int) {
- return vs.MetricsAddress, vs.MetricsIntervalSec
- })
+ go stats.LoopPushingMetric("volumeServer", hostAddress, stats.VolumeServerGather, vs.MetricsAddress, vs.MetricsIntervalSec)
return vs
}