vadimartynov
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
29 changed files with
35 additions and
28 deletions
-
unmaintained/diff_volume_servers/diff_volume_servers.go
-
unmaintained/repeated_vacuum/repeated_vacuum.go
-
unmaintained/stream_read_volume/stream_read_volume.go
-
unmaintained/volume_tailer/volume_tailer.go
-
weed/command/backup.go
-
weed/command/benchmark.go
-
weed/command/download.go
-
weed/command/filer.go
-
weed/command/filer_backup.go
-
weed/command/filer_cat.go
-
weed/command/filer_copy.go
-
weed/command/filer_meta_backup.go
-
weed/command/filer_meta_tail.go
-
weed/command/filer_remote_gateway.go
-
weed/command/filer_remote_sync.go
-
weed/command/filer_replication.go
-
weed/command/filer_sync.go
-
weed/command/iam.go
-
weed/command/master.go
-
weed/command/master_follower.go
-
weed/command/mount_std.go
-
weed/command/mq_broker.go
-
weed/command/s3.go
-
weed/command/server.go
-
weed/command/shell.go
-
weed/command/upload.go
-
weed/command/volume.go
-
weed/command/webdav.go
-
weed/util/config.go
|
@ -41,7 +41,7 @@ var ( |
|
|
func main() { |
|
|
func main() { |
|
|
flag.Parse() |
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
vid := uint32(*volumeId) |
|
|
vid := uint32(*volumeId) |
|
|
|
@ -26,7 +26,7 @@ var ( |
|
|
func main() { |
|
|
func main() { |
|
|
flag.Parse() |
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
genFile(grpcDialOption, 0) |
|
|
genFile(grpcDialOption, 0) |
|
|
|
@ -24,7 +24,7 @@ var ( |
|
|
func main() { |
|
|
func main() { |
|
|
flag.Parse() |
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
vid := uint32(*volumeId) |
|
|
vid := uint32(*volumeId) |
|
|
|
@ -25,7 +25,7 @@ var ( |
|
|
func main() { |
|
|
func main() { |
|
|
flag.Parse() |
|
|
flag.Parse() |
|
|
|
|
|
|
|
|
util2.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util2.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util2.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util2.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
vid := needle.VolumeId(*volumeId) |
|
|
vid := needle.VolumeId(*volumeId) |
|
|
|
@ -66,7 +66,7 @@ var cmdBackup = &Command{ |
|
|
|
|
|
|
|
|
func runBackup(cmd *Command, args []string) bool { |
|
|
func runBackup(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
if *s.volumeId == -1 { |
|
|
if *s.volumeId == -1 { |
|
|
|
@ -111,7 +111,7 @@ var ( |
|
|
|
|
|
|
|
|
func runBenchmark(cmd *Command, args []string) bool { |
|
|
func runBenchmark(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
b.grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
b.grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.Version(), runtime.GOOS, runtime.GOARCH) |
|
|
fmt.Printf("This is SeaweedFS version %s %s %s\n", util.Version(), runtime.GOOS, runtime.GOARCH) |
|
|
|
@ -47,7 +47,7 @@ var cmdDownload = &Command{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func runDownload(cmd *Command, args []string) bool { |
|
|
func runDownload(cmd *Command, args []string) bool { |
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
for _, fid := range args { |
|
|
for _, fid := range args { |
|
|
|
@ -178,7 +178,7 @@ func runFiler(cmd *Command, args []string) bool { |
|
|
go http.ListenAndServe(fmt.Sprintf(":%d", *f.debugPort), nil) |
|
|
go http.ListenAndServe(fmt.Sprintf(":%d", *f.debugPort), nil) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
switch { |
|
|
switch { |
|
|
case *f.metricsHttpIp != "": |
|
|
case *f.metricsHttpIp != "": |
|
|
|
@ -59,7 +59,7 @@ var cmdFilerBackup = &Command{ |
|
|
|
|
|
|
|
|
func runFilerBackup(cmd *Command, args []string) bool { |
|
|
func runFilerBackup(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
util.LoadConfiguration("replication", true) |
|
|
util.LoadConfiguration("replication", true) |
|
|
|
|
|
|
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
@ -59,7 +59,7 @@ var cmdFilerCat = &Command{ |
|
|
|
|
|
|
|
|
func runFilerCat(cmd *Command, args []string) bool { |
|
|
func runFilerCat(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
if len(args) == 0 { |
|
|
if len(args) == 0 { |
|
|
return false |
|
|
return false |
|
|
|
@ -83,7 +83,7 @@ var cmdFilerCopy = &Command{ |
|
|
|
|
|
|
|
|
func runCopy(cmd *Command, args []string) bool { |
|
|
func runCopy(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
if len(args) <= 1 { |
|
|
if len(args) <= 1 { |
|
|
return false |
|
|
return false |
|
|
|
@ -56,7 +56,7 @@ The backup writes to another filer store specified in a backup_filer.toml. |
|
|
|
|
|
|
|
|
func runFilerMetaBackup(cmd *Command, args []string) bool { |
|
|
func runFilerMetaBackup(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
metaBackup.grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
metaBackup.grpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
// load backup_filer.toml
|
|
|
// load backup_filer.toml
|
|
|
|
@ -45,7 +45,7 @@ var ( |
|
|
|
|
|
|
|
|
func runFilerMetaTail(cmd *Command, args []string) bool { |
|
|
func runFilerMetaTail(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
clientId := util.RandomInt32() |
|
|
clientId := util.RandomInt32() |
|
|
|
|
|
|
|
|
|
@ -78,7 +78,7 @@ var cmdFilerRemoteGateway = &Command{ |
|
|
|
|
|
|
|
|
func runFilerRemoteGateway(cmd *Command, args []string) bool { |
|
|
func runFilerRemoteGateway(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
remoteGatewayOptions.grpcDialOption = grpcDialOption |
|
|
remoteGatewayOptions.grpcDialOption = grpcDialOption |
|
|
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ var cmdFilerRemoteSynchronize = &Command{ |
|
|
|
|
|
|
|
|
func runFilerRemoteSynchronize(cmd *Command, args []string) bool { |
|
|
func runFilerRemoteSynchronize(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
remoteSyncOptions.grpcDialOption = grpcDialOption |
|
|
remoteSyncOptions.grpcDialOption = grpcDialOption |
|
|
|
|
|
|
|
|
|
@ -30,7 +30,7 @@ var cmdFilerReplicate = &Command{ |
|
|
|
|
|
|
|
|
func runFilerReplicate(cmd *Command, args []string) bool { |
|
|
func runFilerReplicate(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
util.LoadConfiguration("replication", true) |
|
|
util.LoadConfiguration("replication", true) |
|
|
util.LoadConfiguration("notification", true) |
|
|
util.LoadConfiguration("notification", true) |
|
|
config := util.GetViper() |
|
|
config := util.GetViper() |
|
|
|
@ -118,7 +118,7 @@ var cmdFilerSynchronize = &Command{ |
|
|
|
|
|
|
|
|
func runFilerSynchronize(cmd *Command, args []string) bool { |
|
|
func runFilerSynchronize(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
grace.SetupProfiling(*syncCpuProfile, *syncMemProfile) |
|
|
grace.SetupProfiling(*syncCpuProfile, *syncMemProfile) |
|
|
|
@ -47,7 +47,7 @@ func runIam(cmd *Command, args []string) bool { |
|
|
func (iamopt *IamOptions) startIamServer() bool { |
|
|
func (iamopt *IamOptions) startIamServer() bool { |
|
|
filerAddress := pb.ServerAddress(*iamopt.filer) |
|
|
filerAddress := pb.ServerAddress(*iamopt.filer) |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
for { |
|
|
for { |
|
|
err := pb.WithGrpcFilerClient(false, 0, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
err := pb.WithGrpcFilerClient(false, 0, filerAddress, grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
@ -105,7 +105,7 @@ var ( |
|
|
|
|
|
|
|
|
func runMaster(cmd *Command, args []string) bool { |
|
|
func runMaster(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
util.LoadConfiguration("master", false) |
|
|
util.LoadConfiguration("master", false) |
|
|
|
|
|
|
|
|
grace.SetupProfiling(*masterCpuProfile, *masterMemProfile) |
|
|
grace.SetupProfiling(*masterCpuProfile, *masterMemProfile) |
|
|
|
@ -68,7 +68,7 @@ var cmdMasterFollower = &Command{ |
|
|
|
|
|
|
|
|
func runMasterFollower(cmd *Command, args []string) bool { |
|
|
func runMasterFollower(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
util.LoadConfiguration("master", false) |
|
|
util.LoadConfiguration("master", false) |
|
|
|
|
|
|
|
|
if *mf.portGrpc == 0 { |
|
|
if *mf.portGrpc == 0 { |
|
|
|
@ -66,7 +66,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool { |
|
|
|
|
|
|
|
|
// try to connect to filer
|
|
|
// try to connect to filer
|
|
|
filerAddresses := pb.ServerAddresses(*option.filer).ToAddresses() |
|
|
filerAddresses := pb.ServerAddresses(*option.filer).ToAddresses() |
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
var cipher bool |
|
|
var cipher bool |
|
|
var err error |
|
|
var err error |
|
|
|
@ -54,7 +54,7 @@ var cmdMqBroker = &Command{ |
|
|
|
|
|
|
|
|
func runMqBroker(cmd *Command, args []string) bool { |
|
|
func runMqBroker(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
mqBrokerStandaloneOptions.masters = pb.ServerAddresses(*mqBrokerStandaloneOptions.mastersString).ToAddressMap() |
|
|
mqBrokerStandaloneOptions.masters = pb.ServerAddresses(*mqBrokerStandaloneOptions.mastersString).ToAddressMap() |
|
|
|
|
|
|
|
|
|
@ -165,7 +165,7 @@ var cmdS3 = &Command{ |
|
|
|
|
|
|
|
|
func runS3(cmd *Command, args []string) bool { |
|
|
func runS3(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
switch { |
|
|
switch { |
|
|
case *s3StandaloneOptions.metricsHttpIp != "": |
|
|
case *s3StandaloneOptions.metricsHttpIp != "": |
|
|
|
@ -179,7 +179,7 @@ func runServer(cmd *Command, args []string) bool { |
|
|
go http.ListenAndServe(fmt.Sprintf(":%d", *serverOptions.debugPort), nil) |
|
|
go http.ListenAndServe(fmt.Sprintf(":%d", *serverOptions.debugPort), nil) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
util.LoadConfiguration("master", false) |
|
|
util.LoadConfiguration("master", false) |
|
|
|
|
|
|
|
|
grace.SetupProfiling(*serverOptions.cpuprofile, *serverOptions.memprofile) |
|
|
grace.SetupProfiling(*serverOptions.cpuprofile, *serverOptions.memprofile) |
|
|
|
@ -35,7 +35,7 @@ var cmdShell = &Command{ |
|
|
|
|
|
|
|
|
func runShell(command *Command, args []string) bool { |
|
|
func runShell(command *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
shellOptions.GrpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
shellOptions.GrpcDialOption = security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
shellOptions.Directory = "/" |
|
|
shellOptions.Directory = "/" |
|
|
|
|
|
|
|
|
|
@ -69,7 +69,7 @@ var cmdUpload = &Command{ |
|
|
|
|
|
|
|
|
func runUpload(cmd *Command, args []string) bool { |
|
|
func runUpload(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") |
|
|
|
|
|
|
|
|
defaultReplication, err := readMasterConfiguration(grpcDialOption, pb.ServerAddress(*upload.master)) |
|
|
defaultReplication, err := readMasterConfiguration(grpcDialOption, pb.ServerAddress(*upload.master)) |
|
|
|
@ -125,7 +125,7 @@ var ( |
|
|
|
|
|
|
|
|
func runVolume(cmd *Command, args []string) bool { |
|
|
func runVolume(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
// If --pprof is set we assume the caller wants to be able to collect
|
|
|
// If --pprof is set we assume the caller wants to be able to collect
|
|
|
// cpu and memory profiles via go tool pprof
|
|
|
// cpu and memory profiles via go tool pprof
|
|
|
|
@ -60,7 +60,7 @@ var cmdWebDav = &Command{ |
|
|
|
|
|
|
|
|
func runWebDav(cmd *Command, args []string) bool { |
|
|
func runWebDav(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
util.LoadConfiguration("security", false) |
|
|
|
|
|
|
|
|
util.LoadSecurityConfiguration() |
|
|
|
|
|
|
|
|
glog.V(0).Infof("Starting Seaweed WebDav Server %s at https port %d", util.Version(), *webDavStandaloneOptions.port) |
|
|
glog.V(0).Infof("Starting Seaweed WebDav Server %s at https port %d", util.Version(), *webDavStandaloneOptions.port) |
|
|
|
|
|
|
|
|
|
@ -11,6 +11,7 @@ import ( |
|
|
|
|
|
|
|
|
var ( |
|
|
var ( |
|
|
ConfigurationFileDirectory DirectoryValueType |
|
|
ConfigurationFileDirectory DirectoryValueType |
|
|
|
|
|
loadSecurityConfigOnce sync.Once |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
type DirectoryValueType string |
|
|
type DirectoryValueType string |
|
@ -31,6 +32,12 @@ type Configuration interface { |
|
|
SetDefault(key string, value interface{}) |
|
|
SetDefault(key string, value interface{}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func LoadSecurityConfiguration(){ |
|
|
|
|
|
loadSecurityConfigOnce.Do(func() { |
|
|
|
|
|
LoadConfiguration("security", false) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func LoadConfiguration(configFileName string, required bool) (loaded bool) { |
|
|
func LoadConfiguration(configFileName string, required bool) (loaded bool) { |
|
|
|
|
|
|
|
|
// find a filer store
|
|
|
// find a filer store
|
|
|