aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-02-03 18:15:16 -0800
committerChris Lu <chris.lu@gmail.com>2020-02-03 18:15:16 -0800
commitdc786a63ac658c6b527d3b5a8e426cb9b8969a20 (patch)
tree9d58f82198a53d9678648287f1e499038e0859d1
parent382ff218d33e07eda91491e87cac51445c8f8fdb (diff)
downloadseaweedfs-dc786a63ac658c6b527d3b5a8e426cb9b8969a20.tar.xz
seaweedfs-dc786a63ac658c6b527d3b5a8e426cb9b8969a20.zip
master: add configurable volume growth toml setting
-rw-r--r--weed/command/scaffold.go9
-rw-r--r--weed/topology/volume_growth.go14
2 files changed, 19 insertions, 4 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index 3aebff396..ab658735f 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -369,6 +369,8 @@ type = "memory" # Choose [memory|etcd] type for storing the file id sequence
sequencer_etcd_urls = "http://127.0.0.1:2379"
+# configurations for tiered cloud storage
+# old volumes are transparently moved to cloud for cost efficiency
[storage.backend]
[storage.backend.s3.default]
enabled = false
@@ -377,5 +379,12 @@ sequencer_etcd_urls = "http://127.0.0.1:2379"
region = "us-east-2"
bucket = "your_bucket_name" # an existing bucket
+# create this number of logical volumes if no more writable volumes
+[master.volume_growth]
+count_1 = 7 # create 1 x 7 = 7 actual volumes
+count_2 = 6 # create 2 x 6 = 12 actual volumes
+count_3 = 3 # create 3 x 3 = 9 actual volumes
+count_other = 1 # create n x 1 = n actual volumes
+
`
)
diff --git a/weed/topology/volume_growth.go b/weed/topology/volume_growth.go
index 80fbc86cd..781a34ba3 100644
--- a/weed/topology/volume_growth.go
+++ b/weed/topology/volume_growth.go
@@ -7,6 +7,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/chrislusf/seaweedfs/weed/storage/super_block"
+ "github.com/chrislusf/seaweedfs/weed/util"
"google.golang.org/grpc"
@@ -48,15 +49,20 @@ func NewDefaultVolumeGrowth() *VolumeGrowth {
// one replication type may need rp.GetCopyCount() actual volumes
// given copyCount, how many logical volumes to create
func (vg *VolumeGrowth) findVolumeCount(copyCount int) (count int) {
+ v := util.GetViper()
+ v.SetDefault("master.volume_growth.copy_1", 7)
+ v.SetDefault("master.volume_growth.copy_2", 6)
+ v.SetDefault("master.volume_growth.copy_3", 3)
+ v.SetDefault("master.volume_growth.copy_other", 1)
switch copyCount {
case 1:
- count = 7
+ count = v.GetInt("master.volume_growth.copy_1")
case 2:
- count = 6
+ count = v.GetInt("master.volume_growth.copy_2")
case 3:
- count = 3
+ count = v.GetInt("master.volume_growth.copy_3")
default:
- count = 1
+ count = v.GetInt("master.volume_growth.copy_other")
}
return
}