aboutsummaryrefslogtreecommitdiff
path: root/weed/command/master.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/master.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/master.go')
-rw-r--r--weed/command/master.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/weed/command/master.go b/weed/command/master.go
index dbd11e60d..7eecdb571 100644
--- a/weed/command/master.go
+++ b/weed/command/master.go
@@ -53,6 +53,7 @@ type MasterOptions struct {
metricsIntervalSec *int
raftResumeState *bool
metricsHttpPort *int
+ metricsHttpIp *string
heartbeatInterval *time.Duration
electionTimeout *time.Duration
raftHashicorp *bool
@@ -77,6 +78,7 @@ func init() {
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.metricsHttpPort = cmdMaster.Flag.Int("metricsPort", 0, "Prometheus metrics listen port")
+ m.metricsHttpIp = cmdMaster.Flag.String("metricsIp", "", "metrics listen ip. If empty, default to same as -ip.bind option.")
m.raftResumeState = cmdMaster.Flag.Bool("resumeState", false, "resume previous state on start master server")
m.heartbeatInterval = cmdMaster.Flag.Duration("heartbeatInterval", 300*time.Millisecond, "heartbeat interval of master servers, and will be randomly multiplied by [1, 1.25)")
m.electionTimeout = cmdMaster.Flag.Duration("electionTimeout", 10*time.Second, "election timeout of master servers")
@@ -121,7 +123,15 @@ func runMaster(cmd *Command, args []string) bool {
glog.Fatalf("volumeSizeLimitMB should be smaller than 30000")
}
- go stats_collect.StartMetricsServer(*m.ipBind, *m.metricsHttpPort)
+ switch {
+ case *m.metricsHttpIp != "":
+ // noting to do, use m.metricsHttpIp
+ case *m.ipBind != "":
+ *m.metricsHttpIp = *m.ipBind
+ case *m.ip != "":
+ *m.metricsHttpIp = *m.ip
+ }
+ go stats_collect.StartMetricsServer(*m.metricsHttpIp, *m.metricsHttpPort)
startMaster(m, masterWhiteList)
return true