|
@ -1,6 +1,7 @@ |
|
|
package command |
|
|
package command |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
|
|
|
"fmt" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"strconv" |
|
|
"strconv" |
|
|
"strings" |
|
|
"strings" |
|
@ -18,7 +19,9 @@ import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
var ( |
|
|
var ( |
|
|
f FilerOptions |
|
|
|
|
|
|
|
|
f FilerOptions |
|
|
|
|
|
filerStartS3 *bool |
|
|
|
|
|
filerS3Options S3Options |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
type FilerOptions struct { |
|
|
type FilerOptions struct { |
|
@ -60,6 +63,14 @@ func init() { |
|
|
f.cipher = cmdFiler.Flag.Bool("encryptVolumeData", false, "encrypt data on volume servers") |
|
|
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.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") |
|
|
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{ |
|
|
var cmdFiler = &Command{ |
|
@ -89,6 +100,15 @@ func runFiler(cmd *Command, args []string) bool { |
|
|
|
|
|
|
|
|
go stats_collect.StartMetricsServer(*f.metricsHttpPort) |
|
|
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() |
|
|
f.startFiler() |
|
|
|
|
|
|
|
|
return true |
|
|
return true |
|
|