aboutsummaryrefslogtreecommitdiff
path: root/weed/command/volume.go
diff options
context:
space:
mode:
authorvadimartynov <166398828+vadimartynov@users.noreply.github.com>2024-07-12 21:56:26 +0400
committerGitHub <noreply@github.com>2024-07-12 10:56:26 -0700
commitec9e7493b34df5c13462cdaeab5b35f152d0cb68 (patch)
tree035534cd1480185b7ffcd94a66b216df70988433 /weed/command/volume.go
parentcb5dae0c9cd0e19c7e865ebf1ddfdf5138e8a74c (diff)
downloadseaweedfs-ec9e7493b34df5c13462cdaeab5b35f152d0cb68.tar.xz
seaweedfs-ec9e7493b34df5c13462cdaeab5b35f152d0cb68.zip
-metricsIp cmd flag (#5773)
* Added/Updated: - Added metrics ip options for all servers; - Fixed a bug with the selection of the binIp or ip parameter for the metrics handler; * Fixed cmd flags
Diffstat (limited to 'weed/command/volume.go')
-rw-r--r--weed/command/volume.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/weed/command/volume.go b/weed/command/volume.go
index 852989d1f..4bd7668d5 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -65,6 +65,7 @@ type VolumeServerOptions struct {
pprof *bool
preStopSeconds *int
metricsHttpPort *int
+ metricsHttpIp *string
// pulseSeconds *int
inflightUploadDataTimeout *time.Duration
hasSlowRead *bool
@@ -99,6 +100,7 @@ func init() {
v.concurrentDownloadLimitMB = cmdVolume.Flag.Int("concurrentDownloadLimitMB", 256, "limit total concurrent download size")
v.pprof = cmdVolume.Flag.Bool("pprof", false, "enable pprof http handlers. precludes --memprofile and --cpuprofile")
v.metricsHttpPort = cmdVolume.Flag.Int("metricsPort", 0, "Prometheus metrics listen port")
+ v.metricsHttpIp = cmdVolume.Flag.String("metricsIp", "", "metrics listen ip. If empty, default to same as -ip.bind option.")
v.idxFolder = cmdVolume.Flag.String("dir.idx", "", "directory to store .idx files")
v.inflightUploadDataTimeout = cmdVolume.Flag.Duration("inflightUploadDataTimeout", 60*time.Second, "inflight upload data wait timeout of volume servers")
v.hasSlowRead = cmdVolume.Flag.Bool("hasSlowRead", true, "<experimental> if true, this prevents slow reads from blocking other requests, but large file read P99 latency will increase.")
@@ -131,7 +133,15 @@ func runVolume(cmd *Command, args []string) bool {
grace.SetupProfiling(*v.cpuProfile, *v.memProfile)
}
- go stats_collect.StartMetricsServer(*v.bindIp, *v.metricsHttpPort)
+ switch {
+ case *v.metricsHttpIp != "":
+ // noting to do, use v.metricsHttpIp
+ case *v.bindIp != "":
+ *v.metricsHttpIp = *v.bindIp
+ case *v.ip != "":
+ *v.metricsHttpIp = *v.ip
+ }
+ go stats_collect.StartMetricsServer(*v.metricsHttpIp, *v.metricsHttpPort)
minFreeSpaces := util.MustParseMinFreeSpace(*minFreeSpace, *minFreeSpacePercent)
v.masters = pb.ServerAddresses(*v.mastersString).ToAddresses()