mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-08 15:41:15 +02:00
mini: expose -volume.max (#11100)
mini hardcoded the per-directory volume limit to 0, so the volume server always auto-sized it as free disk space divided by the volume size. That sizing reserves a whole volume size for every writable volume, so a workload spreading small objects over many buckets runs out of slots long before the disk fills and assign starts failing with "no free volumes left". Same name and semantics as the flag weed server already carries, and still 0 (auto) by default. Claude-Session: https://claude.ai/code/session_01BiQLeBvZLzG8XitjiypDKu
This commit is contained in:
+16
-15
@@ -48,14 +48,13 @@ type MiniOptions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
bytesPerMB = 1024 * 1024 // Bytes per MB
|
bytesPerMB = 1024 * 1024 // Bytes per MB
|
||||||
miniVolumeMaxDataVolumeCounts = "0" // auto-configured based on free disk space
|
miniVolumeMinFreeSpace = "1" // 1% minimum free space
|
||||||
miniVolumeMinFreeSpace = "1" // 1% minimum free space
|
minVolumeSizeMB = 64 // Minimum volume size in MB
|
||||||
minVolumeSizeMB = 64 // Minimum volume size in MB
|
defaultMiniVolumeSizeMB = 128 // Default volume size for mini mode
|
||||||
defaultMiniVolumeSizeMB = 128 // Default volume size for mini mode
|
maxVolumeSizeMB = 1024 // Maximum volume size in MB (1GB)
|
||||||
maxVolumeSizeMB = 1024 // Maximum volume size in MB (1GB)
|
GrpcPortOffset = 10000 // Offset used to calculate gRPC port from HTTP port
|
||||||
GrpcPortOffset = 10000 // Offset used to calculate gRPC port from HTTP port
|
defaultMiniPluginJobTypes = "all"
|
||||||
defaultMiniPluginJobTypes = "all"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -66,11 +65,12 @@ var (
|
|||||||
miniWebDavOptions WebDavOption
|
miniWebDavOptions WebDavOption
|
||||||
miniAdminOptions AdminOptions
|
miniAdminOptions AdminOptions
|
||||||
// Track which port flags were explicitly passed on CLI before config file is applied
|
// Track which port flags were explicitly passed on CLI before config file is applied
|
||||||
explicitPortFlags map[string]bool
|
explicitPortFlags map[string]bool
|
||||||
miniEnableWebDAV *bool
|
miniEnableWebDAV *bool
|
||||||
miniEnableS3 *bool
|
miniEnableS3 *bool
|
||||||
miniEnableAdminUI *bool
|
miniEnableAdminUI *bool
|
||||||
miniS3IamReadOnly *bool
|
miniS3IamReadOnly *bool
|
||||||
|
miniVolumeMaxDataVolumeCounts *string
|
||||||
// MiniClusterCtx is the context for the mini cluster. If set, the mini cluster will stop when the context is cancelled.
|
// MiniClusterCtx is the context for the mini cluster. If set, the mini cluster will stop when the context is cancelled.
|
||||||
MiniClusterCtx context.Context
|
MiniClusterCtx context.Context
|
||||||
|
|
||||||
@@ -343,7 +343,7 @@ S3 gateway, WebDAV gateway, and Admin UI).
|
|||||||
|
|
||||||
All settings are optimized for small/dev use cases:
|
All settings are optimized for small/dev use cases:
|
||||||
- Volume size limit: auto configured based on disk space (64MB-1024MB)
|
- Volume size limit: auto configured based on disk space (64MB-1024MB)
|
||||||
- Volume max: 0 (auto-configured based on free disk space)
|
- Volume max: 0 (auto-configured based on free disk space), see -volume.max
|
||||||
- Pre-stop seconds: 1 (faster shutdown)
|
- Pre-stop seconds: 1 (faster shutdown)
|
||||||
- Master peers: none (single master mode)
|
- Master peers: none (single master mode)
|
||||||
|
|
||||||
@@ -468,6 +468,7 @@ func initMiniFilerFlags() {
|
|||||||
|
|
||||||
// initMiniVolumeFlags initializes Volume server flag options
|
// initMiniVolumeFlags initializes Volume server flag options
|
||||||
func initMiniVolumeFlags() {
|
func initMiniVolumeFlags() {
|
||||||
|
miniVolumeMaxDataVolumeCounts = cmdMini.Flag.String("volume.max", "0", "maximum numbers of volumes, count[,count]... If set to zero, the limit will be auto configured as free disk space divided by volume size.")
|
||||||
miniOptions.v.port = cmdMini.Flag.Int("volume.port", 9340, "volume server http listen port")
|
miniOptions.v.port = cmdMini.Flag.Int("volume.port", 9340, "volume server http listen port")
|
||||||
miniOptions.v.portGrpc = cmdMini.Flag.Int("volume.port.grpc", 0, "volume server grpc listen port")
|
miniOptions.v.portGrpc = cmdMini.Flag.Int("volume.port.grpc", 0, "volume server grpc listen port")
|
||||||
miniOptions.v.publicPort = cmdMini.Flag.Int("volume.port.public", 0, "volume server public port")
|
miniOptions.v.publicPort = cmdMini.Flag.Int("volume.port.public", 0, "volume server public port")
|
||||||
@@ -1433,7 +1434,7 @@ func startMiniServices(miniWhiteList []string, allServicesReady chan struct{}) {
|
|||||||
defer reportMiniStopped("Volume")
|
defer reportMiniStopped("Volume")
|
||||||
startMiniService("Volume", func() {
|
startMiniService("Volume", func() {
|
||||||
minFreeSpaces := util.MustParseMinFreeSpace(miniVolumeMinFreeSpace, "")
|
minFreeSpaces := util.MustParseMinFreeSpace(miniVolumeMinFreeSpace, "")
|
||||||
miniOptions.v.startVolumeServer(*miniDataFolders, miniVolumeMaxDataVolumeCounts, *miniWhiteListOption, minFreeSpaces)
|
miniOptions.v.startVolumeServer(*miniDataFolders, *miniVolumeMaxDataVolumeCounts, *miniWhiteListOption, minFreeSpaces)
|
||||||
}, *miniOptions.v.port)
|
}, *miniOptions.v.port)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user