Browse Source

ssue 59: Multi Ip Enviromment support + publicUrl is disregarded by

master
pull/2/head
Chris Lu 11 years ago
parent
commit
eeeccf2f78
  1. 2
      go/operation/allocate_volume.go
  2. 5
      go/weed/master.go
  3. 2
      go/weed/volume.go

2
go/operation/allocate_volume.go

@ -18,7 +18,7 @@ func AllocateVolume(dn *topology.DataNode, vid storage.VolumeId, collection stri
values.Add("volume", vid.String()) values.Add("volume", vid.String())
values.Add("collection", collection) values.Add("collection", collection)
values.Add("replicationType", repType.String()) values.Add("replicationType", repType.String())
jsonBlob, err := util.Post("http://"+dn.Url()+"/admin/assign_volume", values)
jsonBlob, err := util.Post("http://"+dn.PublicUrl+"/admin/assign_volume", values)
if err != nil { if err != nil {
return err return err
} }

5
go/weed/master.go

@ -27,6 +27,7 @@ var cmdMaster = &Command{
var ( var (
mport = cmdMaster.Flag.Int("port", 9333, "http listen port") mport = cmdMaster.Flag.Int("port", 9333, "http listen port")
mip = cmdMaster.Flag.String("ip", "localhost", "http listen port")
metaFolder = cmdMaster.Flag.String("mdir", os.TempDir(), "data directory to store mappings") metaFolder = cmdMaster.Flag.String("mdir", os.TempDir(), "data directory to store mappings")
volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 32*1024, "Default Volume Size in MegaBytes") volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 32*1024, "Default Volume Size in MegaBytes")
mpulse = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats") mpulse = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
@ -55,9 +56,9 @@ func runMaster(cmd *Command, args []string) bool {
*volumeSizeLimitMB, *mpulse, *confFile, *defaultRepType, *garbageThreshold, masterWhiteList, *volumeSizeLimitMB, *mpulse, *confFile, *defaultRepType, *garbageThreshold, masterWhiteList,
) )
glog.V(0).Infoln("Start Weed Master", VERSION, "at port", strconv.Itoa(*mport))
glog.V(0).Infoln("Start Weed Master", VERSION, "at port", *mip+":"+strconv.Itoa(*mport))
srv := &http.Server{ srv := &http.Server{
Addr: ":" + strconv.Itoa(*mport),
Addr: *mip+":" + strconv.Itoa(*mport),
Handler: r, Handler: r,
ReadTimeout: time.Duration(*mReadTimeout) * time.Second, ReadTimeout: time.Duration(*mReadTimeout) * time.Second,
} }

2
go/weed/volume.go

@ -87,7 +87,7 @@ func runVolume(cmd *Command, args []string) bool {
glog.V(0).Infoln("Start Weed volume server", VERSION, "at http://"+*ip+":"+strconv.Itoa(*vport)) glog.V(0).Infoln("Start Weed volume server", VERSION, "at http://"+*ip+":"+strconv.Itoa(*vport))
srv := &http.Server{ srv := &http.Server{
Addr: ":" + strconv.Itoa(*vport),
Addr: *ip + ":" + strconv.Itoa(*vport),
Handler: r, Handler: r,
ReadTimeout: (time.Duration(*vReadTimeout) * time.Second), ReadTimeout: (time.Duration(*vReadTimeout) * time.Second),
} }

Loading…
Cancel
Save