aboutsummaryrefslogtreecommitdiff
path: root/weed/command/volume.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2025-10-31 17:08:00 -0700
committerGitHub <noreply@github.com>2025-10-31 17:08:00 -0700
commit5ab49e29712a8ef9fed723c64b668d7e58675566 (patch)
tree3e3bf9746dd2300f14fb1643b03380033aa8d6da /weed/command/volume.go
parent58acc14d2cfb1406901c2ed983e5b752df43d97a (diff)
downloadseaweedfs-5ab49e29712a8ef9fed723c64b668d7e58675566.tar.xz
seaweedfs-5ab49e29712a8ef9fed723c64b668d7e58675566.zip
Adjust cli option (#7418)
* adjust "weed benchmark" CLI to use readOnly/writeOnly * consistently use "-master" CLI option * If both -readOnly and -writeOnly are specified, the current logic silently allows it with -writeOnly taking precedence. This is confusing and could lead to unexpected behavior.
Diffstat (limited to 'weed/command/volume.go')
-rw-r--r--weed/command/volume.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/weed/command/volume.go b/weed/command/volume.go
index c18ed3222..58dee0e52 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -44,6 +44,7 @@ type VolumeServerOptions struct {
publicUrl *string
bindIp *string
mastersString *string
+ mserverString *string // deprecated, for backward compatibility
masters []pb.ServerAddress
idleConnectionTimeout *int
dataCenter *string
@@ -79,7 +80,8 @@ func init() {
v.ip = cmdVolume.Flag.String("ip", util.DetectedHostAddress(), "ip or server name, also used as identifier")
v.publicUrl = cmdVolume.Flag.String("publicUrl", "", "Publicly accessible address")
v.bindIp = cmdVolume.Flag.String("ip.bind", "", "ip address to bind to. If empty, default to same as -ip option.")
- v.mastersString = cmdVolume.Flag.String("mserver", "localhost:9333", "comma-separated master servers")
+ v.mastersString = cmdVolume.Flag.String("master", "localhost:9333", "comma-separated master servers")
+ v.mserverString = cmdVolume.Flag.String("mserver", "", "comma-separated master servers (deprecated, use -master instead)")
v.preStopSeconds = cmdVolume.Flag.Int("preStopSeconds", 10, "number of seconds between stop send heartbeats and stop volume server")
// v.pulseSeconds = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats, must be smaller than or equal to the master's setting")
v.idleConnectionTimeout = cmdVolume.Flag.Int("idleTimeout", 30, "connection idle seconds")
@@ -107,7 +109,7 @@ func init() {
}
var cmdVolume = &Command{
- UsageLine: "volume -port=8080 -dir=/tmp -max=5 -ip=server_name -mserver=localhost:9333",
+ UsageLine: "volume -port=8080 -dir=/tmp -max=5 -ip=server_name -master=localhost:9333",
Short: "start a volume server",
Long: `start a volume server to provide storage spaces
@@ -142,6 +144,11 @@ func runVolume(cmd *Command, args []string) bool {
}
go stats_collect.StartMetricsServer(*v.metricsHttpIp, *v.metricsHttpPort)
+ // Backward compatibility: if -mserver is provided, use it
+ if *v.mserverString != "" {
+ *v.mastersString = *v.mserverString
+ }
+
minFreeSpaces := util.MustParseMinFreeSpace(*minFreeSpace, *minFreeSpacePercent)
v.masters = pb.ServerAddresses(*v.mastersString).ToAddresses()
v.startVolumeServer(*volumeFolders, *maxVolumeCounts, *volumeWhiteListOption, minFreeSpaces)