Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
This commit is contained in:
14
weed/cluster/maintenance/maintenance_config.go
Normal file
14
weed/cluster/maintenance/maintenance_config.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package maintenance
|
||||||
|
|
||||||
|
const DefaultMasterMaintenanceScripts = `
|
||||||
|
lock
|
||||||
|
ec.encode -fullPercent=95 -quietFor=1h
|
||||||
|
ec.rebuild -apply
|
||||||
|
ec.balance -apply
|
||||||
|
fs.log.purge -daysAgo=7
|
||||||
|
volume.deleteEmpty -quietFor=24h -apply
|
||||||
|
volume.balance -apply
|
||||||
|
volume.fix.replication -apply
|
||||||
|
s3.clean.uploads -timeAgo=24h
|
||||||
|
unlock
|
||||||
|
`
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
package scaffold
|
package scaffold
|
||||||
|
|
||||||
import _ "embed"
|
import (
|
||||||
|
_ "embed"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/cluster/maintenance"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Master = strings.ReplaceAll(masterTemplate, "{{DEFAULT_MAINTENANCE_SCRIPTS}}", maintenance.DefaultMasterMaintenanceScripts)
|
||||||
|
}
|
||||||
|
|
||||||
//go:embed filer.toml
|
//go:embed filer.toml
|
||||||
var Filer string
|
var Filer string
|
||||||
@@ -15,6 +24,7 @@ var Replication string
|
|||||||
var Security string
|
var Security string
|
||||||
|
|
||||||
//go:embed master.toml
|
//go:embed master.toml
|
||||||
|
var masterTemplate string
|
||||||
var Master string
|
var Master string
|
||||||
|
|
||||||
//go:embed shell.toml
|
//go:embed shell.toml
|
||||||
|
|||||||
@@ -6,17 +6,7 @@
|
|||||||
|
|
||||||
[master.maintenance]
|
[master.maintenance]
|
||||||
# periodically run these scripts are the same as running them from 'weed shell'
|
# periodically run these scripts are the same as running them from 'weed shell'
|
||||||
scripts = """
|
scripts = """{{DEFAULT_MAINTENANCE_SCRIPTS}}"""
|
||||||
lock
|
|
||||||
ec.encode -fullPercent=95 -quietFor=1h
|
|
||||||
ec.rebuild -apply
|
|
||||||
ec.balance -apply
|
|
||||||
volume.deleteEmpty -quietFor=24h -apply
|
|
||||||
volume.balance -apply
|
|
||||||
volume.fix.replication -apply
|
|
||||||
s3.clean.uploads -timeAgo=24h
|
|
||||||
unlock
|
|
||||||
"""
|
|
||||||
sleep_minutes = 17 # sleep minutes between each script execution
|
sleep_minutes = 17 # sleep minutes between each script execution
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/cluster/maintenance"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/stats"
|
"github.com/seaweedfs/seaweedfs/weed/stats"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/telemetry"
|
"github.com/seaweedfs/seaweedfs/weed/telemetry"
|
||||||
|
|
||||||
@@ -312,6 +313,7 @@ func (ms *MasterServer) proxyToLeader(f http.HandlerFunc) http.HandlerFunc {
|
|||||||
|
|
||||||
func (ms *MasterServer) startAdminScripts() {
|
func (ms *MasterServer) startAdminScripts() {
|
||||||
v := util.GetViper()
|
v := util.GetViper()
|
||||||
|
v.SetDefault("master.maintenance.scripts", maintenance.DefaultMasterMaintenanceScripts)
|
||||||
adminScripts := v.GetString("master.maintenance.scripts")
|
adminScripts := v.GetString("master.maintenance.scripts")
|
||||||
if adminScripts == "" {
|
if adminScripts == "" {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user