mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust help message
This commit is contained in:
parent
8a2d529759
commit
c7d5a0b00c
|
@ -79,8 +79,10 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer
|
||||||
}
|
}
|
||||||
|
|
||||||
typeToNodes := collectVolumeServersByType(resp.TopologyInfo, *dc)
|
typeToNodes := collectVolumeServersByType(resp.TopologyInfo, *dc)
|
||||||
for _, volumeServers := range typeToNodes {
|
|
||||||
|
for maxVolumeCount, volumeServers := range typeToNodes {
|
||||||
if len(volumeServers) < 2 {
|
if len(volumeServers) < 2 {
|
||||||
|
fmt.Printf("only 1 node is configured max %d volumes, skipping balancing\n", maxVolumeCount)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if *collection == "EACH_COLLECTION" {
|
if *collection == "EACH_COLLECTION" {
|
||||||
|
@ -93,8 +95,8 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if *collection == "ALL" {
|
} else if *collection == "ALL_COLLECTIONS" {
|
||||||
if err = balanceVolumeServers(commandEnv, volumeServers, resp.VolumeSizeLimitMb*1024*1024, "ALL", *applyBalancing); err != nil {
|
if err = balanceVolumeServers(commandEnv, volumeServers, resp.VolumeSizeLimitMb*1024*1024, "ALL_COLLECTIONS", *applyBalancing); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -108,6 +110,7 @@ func (c *commandVolumeBalance) Do(args []string, commandEnv *CommandEnv, writer
|
||||||
}
|
}
|
||||||
|
|
||||||
func balanceVolumeServers(commandEnv *CommandEnv, dataNodeInfos []*master_pb.DataNodeInfo, volumeSizeLimit uint64, collection string, applyBalancing bool) error {
|
func balanceVolumeServers(commandEnv *CommandEnv, dataNodeInfos []*master_pb.DataNodeInfo, volumeSizeLimit uint64, collection string, applyBalancing bool) error {
|
||||||
|
|
||||||
var nodes []*Node
|
var nodes []*Node
|
||||||
for _, dn := range dataNodeInfos {
|
for _, dn := range dataNodeInfos {
|
||||||
nodes = append(nodes, &Node{
|
nodes = append(nodes, &Node{
|
||||||
|
@ -118,7 +121,7 @@ func balanceVolumeServers(commandEnv *CommandEnv, dataNodeInfos []*master_pb.Dat
|
||||||
// balance writable volumes
|
// balance writable volumes
|
||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
n.selectVolumes(func(v *master_pb.VolumeInformationMessage) bool {
|
n.selectVolumes(func(v *master_pb.VolumeInformationMessage) bool {
|
||||||
if collection != "ALL" {
|
if collection != "ALL_COLLECTIONS" {
|
||||||
if v.Collection != collection {
|
if v.Collection != collection {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -133,7 +136,7 @@ func balanceVolumeServers(commandEnv *CommandEnv, dataNodeInfos []*master_pb.Dat
|
||||||
// balance readable volumes
|
// balance readable volumes
|
||||||
for _, n := range nodes {
|
for _, n := range nodes {
|
||||||
n.selectVolumes(func(v *master_pb.VolumeInformationMessage) bool {
|
n.selectVolumes(func(v *master_pb.VolumeInformationMessage) bool {
|
||||||
if collection != "ALL" {
|
if collection != "ALL_COLLECTIONS" {
|
||||||
if v.Collection != collection {
|
if v.Collection != collection {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue