aboutsummaryrefslogtreecommitdiff
path: root/weed/command/master_follower.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-03-15 22:28:18 -0700
committerchrislu <chris.lu@gmail.com>2022-03-15 22:28:18 -0700
commit3639cad69cf58f7161aff2a639829c195d08ec30 (patch)
tree9f45239b5ef240a36f22b428cbb88438c551ab2b /weed/command/master_follower.go
parentfbc9f0eb64346fdfcdb70e43bedec068f1447c64 (diff)
downloadseaweedfs-3639cad69cf58f7161aff2a639829c195d08ec30.tar.xz
seaweedfs-3639cad69cf58f7161aff2a639829c195d08ec30.zip
master, filer, s3: also listen to "localhost" in addition to specific ip address
related to https://github.com/chrislusf/seaweedfs/issues/1937
Diffstat (limited to 'weed/command/master_follower.go')
-rw-r--r--weed/command/master_follower.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/weed/command/master_follower.go b/weed/command/master_follower.go
index 2c71b34d5..502ce3cd3 100644
--- a/weed/command/master_follower.go
+++ b/weed/command/master_follower.go
@@ -119,14 +119,14 @@ func startMasterFollower(masterOptions MasterOptions) {
ms := weed_server.NewMasterServer(r, option, masters)
listeningAddress := util.JoinHostPort(*masterOptions.ipBind, *masterOptions.port)
glog.V(0).Infof("Start Seaweed Master %s at %s", util.Version(), listeningAddress)
- masterListener, e := util.NewListener(listeningAddress, 0)
+ masterListener, masterLocalListner, e := util.NewIpAndLocalListeners(*masterOptions.ipBind, *masterOptions.port, 0)
if e != nil {
glog.Fatalf("Master startup error: %v", e)
}
// starting grpc server
grpcPort := *masterOptions.portGrpc
- grpcL, err := util.NewListener(util.JoinHostPort(*masterOptions.ipBind, grpcPort), 0)
+ grpcL, grpcLocalL, err := util.NewIpAndLocalListeners(*masterOptions.ipBind, grpcPort, 0)
if err != nil {
glog.Fatalf("master failed to listen on grpc port %d: %v", grpcPort, err)
}
@@ -134,12 +134,18 @@ func startMasterFollower(masterOptions MasterOptions) {
master_pb.RegisterSeaweedServer(grpcS, ms)
reflection.Register(grpcS)
glog.V(0).Infof("Start Seaweed Master %s grpc server at %s:%d", util.Version(), *masterOptions.ip, grpcPort)
+ if grpcLocalL != nil {
+ go grpcS.Serve(grpcLocalL)
+ }
go grpcS.Serve(grpcL)
go ms.MasterClient.KeepConnectedToMaster()
// start http server
httpS := &http.Server{Handler: r}
+ if masterLocalListner != nil {
+ go httpS.Serve(masterLocalListner)
+ }
go httpS.Serve(masterListener)
select {}