diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-11-10 01:31:50 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-11-10 01:31:50 -0800 |
| commit | 1888d01fa0329f60732ab6d7defc95ee257af4e0 (patch) | |
| tree | 8444dbaaf0c3fd5c4ac33c31e177bc9b883cdd58 /go/weed/master.go | |
| parent | 5cb6590eaee59bd02fbe3e58084aba8079861112 (diff) | |
| download | seaweedfs-1888d01fa0329f60732ab6d7defc95ee257af4e0.tar.xz seaweedfs-1888d01fa0329f60732ab6d7defc95ee257af4e0.zip | |
adding etcd storage support for cluster meta data. Currently just
sequence. More to come...
Diffstat (limited to 'go/weed/master.go')
| -rw-r--r-- | go/weed/master.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/go/weed/master.go b/go/weed/master.go index c1ada76fb..950aaca6d 100644 --- a/go/weed/master.go +++ b/go/weed/master.go @@ -5,12 +5,14 @@ import ( "code.google.com/p/weed-fs/go/glog" "code.google.com/p/weed-fs/go/operation" "code.google.com/p/weed-fs/go/replication" + "code.google.com/p/weed-fs/go/sequence" "code.google.com/p/weed-fs/go/storage" "code.google.com/p/weed-fs/go/topology" "encoding/json" "errors" "net/http" "os" + "path" "runtime" "strconv" "strings" @@ -43,6 +45,7 @@ var ( mMaxCpu = cmdMaster.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs") garbageThreshold = cmdMaster.Flag.String("garbageThreshold", "0.3", "threshold to vacuum and reclaim spaces") masterWhiteListOption = cmdMaster.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.") + etcdCluster = cmdMaster.Flag.String("etcd", "", "comma separated etcd urls, e.g., http://localhost:4001, See github.com/coreos/go-etcd/etcd") masterWhiteList []string ) @@ -215,8 +218,14 @@ func runMaster(cmd *Command, args []string) bool { if *masterWhiteListOption != "" { masterWhiteList = strings.Split(*masterWhiteListOption, ",") } + var seq sequence.Sequencer + if len(*etcdCluster) == 0 { + seq = sequence.NewFileSequencer(path.Join(*metaFolder, "weed.seq")) + } else { + seq = sequence.NewEtcdSequencer(*etcdCluster) + } var e error - if topo, e = topology.NewTopology("topo", *confFile, *metaFolder, "weed", + if topo, e = topology.NewTopology("topo", *confFile, seq, uint64(*volumeSizeLimitMB)*1024*1024, *mpulse); e != nil { glog.Fatalf("cannot create topology:%s", e) } |
