From ba179b154259ef2790e30f068c4368658de7c512 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 20 Sep 2014 23:30:35 -0700 Subject: [PATCH] Add "-ip.bind" option when starting volume servers. Also some Weed->Seaweed changes. --- go/weed/master.go | 2 +- go/weed/server.go | 9 +++++---- go/weed/volume.go | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/go/weed/master.go b/go/weed/master.go index b95ca5cb1..ef2c062b5 100644 --- a/go/weed/master.go +++ b/go/weed/master.go @@ -63,7 +63,7 @@ func runMaster(cmd *Command, args []string) bool { listeningAddress := *masterIp + ":" + strconv.Itoa(*mport) - glog.V(0).Infoln("Start Weed Master", util.VERSION, "at", listeningAddress) + glog.V(0).Infoln("Start Seaweed Master", util.VERSION, "at", listeningAddress) listener, e := util.NewListener(listeningAddress, time.Duration(*mTimeout)*time.Second) if e != nil { diff --git a/go/weed/server.go b/go/weed/server.go index 66fbaa120..32bad976a 100644 --- a/go/weed/server.go +++ b/go/weed/server.go @@ -48,6 +48,7 @@ var cmdServer = &Command{ var ( serverIp = cmdServer.Flag.String("ip", "", "ip or server name") serverPublicIp = cmdServer.Flag.String("publicIp", "", "ip or server name") + serverBindIp = cmdVolume.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to") serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs") serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds") serverDataCenter = cmdServer.Flag.String("dataCenter", "", "current volume server's data center name") @@ -178,8 +179,8 @@ func runServer(cmd *Command, args []string) bool { *masterVolumeSizeLimitMB, *volumePulse, *masterConfFile, *masterDefaultReplicaPlacement, *serverGarbageThreshold, serverWhiteList, ) - glog.V(0).Infoln("Start Weed Master", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*masterPort)) - masterListener, e := util.NewListener(*serverIp+":"+strconv.Itoa(*masterPort), time.Duration(*serverTimeout)*time.Second) + glog.V(0).Infoln("Start Seaweed Master", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*masterPort)) + masterListener, e := util.NewListener(*serverBindIp+":"+strconv.Itoa(*masterPort), time.Duration(*serverTimeout)*time.Second) if e != nil { glog.Fatalf(e.Error()) } @@ -211,9 +212,9 @@ func runServer(cmd *Command, args []string) bool { *volumeFixJpgOrientation, ) - glog.V(0).Infoln("Start Weed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort)) + glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort)) volumeListener, e := util.NewListener( - *serverIp+":"+strconv.Itoa(*volumePort), + *serverBindIp+":"+strconv.Itoa(*volumePort), time.Duration(*serverTimeout)*time.Second, ) if e != nil { diff --git a/go/weed/volume.go b/go/weed/volume.go index 8aa52c43d..7a57730cd 100644 --- a/go/weed/volume.go +++ b/go/weed/volume.go @@ -30,6 +30,7 @@ var ( maxVolumeCounts = cmdVolume.Flag.String("max", "7", "maximum numbers of volumes, count[,count]...") ip = cmdVolume.Flag.String("ip", "", "ip or server name") publicIp = cmdVolume.Flag.String("publicIp", "", "Publicly accessible ") + bindIp = cmdVolume.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to") masterNode = cmdVolume.Flag.String("mserver", "localhost:9333", "master server location") vpulse = cmdVolume.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats, must be smaller than or equal to the master's setting") vTimeout = cmdVolume.Flag.Int("idleTimeout", 10, "connection idle seconds") @@ -84,9 +85,9 @@ func runVolume(cmd *Command, args []string) bool { *fixJpgOrientation, ) - listeningAddress := *ip + ":" + strconv.Itoa(*vport) + listeningAddress := *bindIp + ":" + strconv.Itoa(*vport) - glog.V(0).Infoln("Start Weed volume server", util.VERSION, "at", listeningAddress) + glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", listeningAddress) listener, e := util.NewListener(listeningAddress, time.Duration(*vTimeout)*time.Second) if e != nil {