aboutsummaryrefslogtreecommitdiff
path: root/go/weed/server.go
diff options
context:
space:
mode:
authorBrian McQueen <bmcquee@l-sclX1Q0DV7-M.local>2014-12-14 00:13:51 -0800
committerBrian McQueen <bmcquee@l-sclX1Q0DV7-M.local>2014-12-14 00:13:51 -0800
commita3583e4e7cdba69346397b963193eda9ed10c3a3 (patch)
tree5c984294280a16779c416a90f0f19e28cb98e7f4 /go/weed/server.go
parentbd664def45925d81dfae9c7edfb244d2367170ca (diff)
parente431d4121e8da8d7fc243b29b780c2cd535a4210 (diff)
downloadseaweedfs-a3583e4e7cdba69346397b963193eda9ed10c3a3.tar.xz
seaweedfs-a3583e4e7cdba69346397b963193eda9ed10c3a3.zip
Merge branch 'master' of https://github.com/chrislusf/weed-fs
Diffstat (limited to 'go/weed/server.go')
-rw-r--r--go/weed/server.go25
1 files changed, 15 insertions, 10 deletions
diff --git a/go/weed/server.go b/go/weed/server.go
index 1d854d641..22222d699 100644
--- a/go/weed/server.go
+++ b/go/weed/server.go
@@ -1,10 +1,6 @@
package main
import (
- "github.com/chrislusf/weed-fs/go/glog"
- "github.com/chrislusf/weed-fs/go/util"
- "github.com/chrislusf/weed-fs/go/weed/weed_server"
- "github.com/gorilla/mux"
"net/http"
"os"
"runtime"
@@ -13,6 +9,11 @@ import (
"strings"
"sync"
"time"
+
+ "github.com/chrislusf/weed-fs/go/glog"
+ "github.com/chrislusf/weed-fs/go/util"
+ "github.com/chrislusf/weed-fs/go/weed/weed_server"
+ "github.com/gorilla/mux"
)
type ServerOptions struct {
@@ -31,17 +32,17 @@ func init() {
var cmdServer = &Command{
UsageLine: "server -port=8080 -dir=/tmp -volume.max=5 -ip=server_name",
Short: "start a server, including volume server, and automatically elect a master server",
- Long: `start both a volume server to provide storage spaces
+ Long: `start both a volume server to provide storage spaces
and a master server to provide volume=>location mapping service and sequence number of file ids
-
+
This is provided as a convenient way to start both volume server and master server.
The servers are exactly the same as starting them separately.
So other volume servers can use this embedded master server also.
-
+
Optionally, one filer server can be started. Logically, filer servers should not be in a cluster.
They run with meta data on disk, not shared. So each filer server is different.
-
+
`,
}
@@ -72,12 +73,14 @@ var (
)
func init() {
- serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "write cpu profile to file")
+ serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file")
filerOptions.master = cmdServer.Flag.String("filer.master", "", "default to current master server")
filerOptions.collection = cmdServer.Flag.String("filer.collection", "", "all data will be stored in this collection")
filerOptions.port = cmdServer.Flag.Int("filer.port", 8888, "filer server http listen port")
filerOptions.dir = cmdServer.Flag.String("filer.dir", "", "directory to store meta data, default to a 'filer' sub directory of what -mdir is specified")
filerOptions.defaultReplicaPlacement = cmdServer.Flag.String("filer.defaultReplicaPlacement", "", "Default replication type if not specified during runtime.")
+ filerOptions.redirectOnRead = cmdServer.Flag.Bool("filer.redirectOnRead", false, "whether proxy or redirect to volume server during file GET request")
+
}
func runServer(cmd *Command, args []string) bool {
@@ -149,7 +152,9 @@ func runServer(cmd *Command, args []string) bool {
if *isStartingFiler {
go func() {
r := http.NewServeMux()
- _, nfs_err := weed_server.NewFilerServer(r, *filerOptions.port, *filerOptions.master, *filerOptions.dir, *filerOptions.collection)
+ _, nfs_err := weed_server.NewFilerServer(r, *filerOptions.port, *filerOptions.master, *filerOptions.dir, *filerOptions.collection,
+ *filerOptions.defaultReplicaPlacement, *filerOptions.redirectOnRead,
+ )
if nfs_err != nil {
glog.Fatalf(nfs_err.Error())
}