aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-09-27 23:00:43 -0700
committerChris Lu <chris.lu@gmail.com>2020-09-27 23:00:43 -0700
commite6552b5e1ef4135106cd30b368eb83d289666fee (patch)
tree8f84ec13bcca9bdf77edcd46f874d6202d3992f1
parent474e2b6ac3896225fe17aa13f1ec7ff8a304717c (diff)
downloadseaweedfs-e6552b5e1ef4135106cd30b368eb83d289666fee.tar.xz
seaweedfs-e6552b5e1ef4135106cd30b368eb83d289666fee.zip
filer: able to start s3 together
-rw-r--r--weed/command/filer.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/weed/command/filer.go b/weed/command/filer.go
index 7ff9fcd9a..c7f2bd981 100644
--- a/weed/command/filer.go
+++ b/weed/command/filer.go
@@ -1,6 +1,7 @@
package command
import (
+ "fmt"
"net/http"
"strconv"
"strings"
@@ -18,7 +19,9 @@ import (
)
var (
- f FilerOptions
+ f FilerOptions
+ filerStartS3 *bool
+ filerS3Options S3Options
)
type FilerOptions struct {
@@ -60,6 +63,14 @@ func init() {
f.cipher = cmdFiler.Flag.Bool("encryptVolumeData", false, "encrypt data on volume servers")
f.peers = cmdFiler.Flag.String("peers", "", "all filers sharing the same filer store in comma separated ip:port list")
f.metricsHttpPort = cmdFiler.Flag.Int("metricsPort", 0, "Prometheus metrics listen port")
+
+ // start s3 on filer
+ filerStartS3 = cmdFiler.Flag.Bool("s3", false, "whether to start S3 gateway")
+ filerS3Options.port = cmdFiler.Flag.Int("s3.port", 8333, "s3 server http listen port")
+ filerS3Options.domainName = cmdFiler.Flag.String("s3.domainName", "", "suffix of the host name, {bucket}.{domainName}")
+ filerS3Options.tlsPrivateKey = cmdFiler.Flag.String("s3.key.file", "", "path to the TLS private key file")
+ filerS3Options.tlsCertificate = cmdFiler.Flag.String("s3.cert.file", "", "path to the TLS certificate file")
+ filerS3Options.config = cmdFiler.Flag.String("s3.config", "", "path to the config file")
}
var cmdFiler = &Command{
@@ -89,6 +100,15 @@ func runFiler(cmd *Command, args []string) bool {
go stats_collect.StartMetricsServer(*f.metricsHttpPort)
+ if *filerStartS3 {
+ filerAddress := fmt.Sprintf("%s:%d", *f.ip, *f.port)
+ filerS3Options.filer = &filerAddress
+ go func() {
+ time.Sleep(2 * time.Second)
+ filerS3Options.startS3Server()
+ }()
+ }
+
f.startFiler()
return true