diff --git a/weed/command/filer.go b/weed/command/filer.go index ce6d79a17..203164d65 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -23,6 +23,7 @@ var ( type FilerOptions struct { masters *string ip *string + bindIp *string port *int publicPort *int collection *string @@ -44,6 +45,7 @@ func init() { f.masters = cmdFiler.Flag.String("master", "localhost:9333", "comma-separated master servers") f.collection = cmdFiler.Flag.String("collection", "", "all data will be stored in this collection") f.ip = cmdFiler.Flag.String("ip", util.DetectedHostAddress(), "filer server http listen ip address") + f.bindIp = cmdFiler.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to") f.port = cmdFiler.Flag.Int("port", 8888, "filer server http listen port") f.publicPort = cmdFiler.Flag.Int("port.readonly", 0, "readonly port opened to public") f.defaultReplicaPlacement = cmdFiler.Flag.String("defaultReplicaPlacement", "000", "default replication type if not specified") @@ -118,7 +120,7 @@ func (fo *FilerOptions) startFiler() { } if *fo.publicPort != 0 { - publicListeningAddress := *fo.ip + ":" + strconv.Itoa(*fo.publicPort) + publicListeningAddress := *fo.bindIp + ":" + strconv.Itoa(*fo.publicPort) glog.V(0).Infoln("Start Seaweed filer server", util.VERSION, "public at", publicListeningAddress) publicListener, e := util.NewListener(publicListeningAddress, 0) if e != nil { @@ -133,7 +135,7 @@ func (fo *FilerOptions) startFiler() { glog.V(0).Infof("Start Seaweed Filer %s at %s:%d", util.VERSION, *fo.ip, *fo.port) filerListener, e := util.NewListener( - *fo.ip+":"+strconv.Itoa(*fo.port), + *fo.bindIp+":"+strconv.Itoa(*fo.port), time.Duration(10)*time.Second, ) if e != nil { diff --git a/weed/command/server.go b/weed/command/server.go index 2f3bbe94d..0d54004f8 100644 --- a/weed/command/server.go +++ b/weed/command/server.go @@ -125,7 +125,8 @@ func runServer(cmd *Command, args []string) bool { masterOptions.ip = serverIp masterOptions.ipBind = serverBindIp filerOptions.masters = &peers - filerOptions.ip = serverBindIp + filerOptions.ip = serverIp + filerOptions.bindIp = serverBindIp serverOptions.v.ip = serverIp serverOptions.v.bindIp = serverBindIp serverOptions.v.masters = &peers