From 076c8bd3bcb6f76c84a8df50aff923d493a6bb9d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 18 Apr 2020 15:17:27 -0700 Subject: filer master start up with default ip address instead of just localhost --- weed/messaging/client/client.go | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'weed/messaging/client/client.go') diff --git a/weed/messaging/client/client.go b/weed/messaging/client/client.go index 9bf9bc71e..3f6d1ca53 100644 --- a/weed/messaging/client/client.go +++ b/weed/messaging/client/client.go @@ -1,11 +1,34 @@ package client +import ( + "context" + + "google.golang.org/grpc" + + "github.com/chrislusf/seaweedfs/weed/pb" + "github.com/chrislusf/seaweedfs/weed/security" + "github.com/chrislusf/seaweedfs/weed/util" +) + type MessagingClient struct { bootstrapBrokers []string + grpcConnection *grpc.ClientConn } -func NewMessagingClient(bootstrapBrokers []string) *MessagingClient { +func NewMessagingClient(bootstrapBrokers []string) (*MessagingClient, error) { + grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.msg_client") + + grpcConnection, err := pb.GrpcDial(context.Background(), "localhost:17777", grpcDialOption) + if err != nil { + return nil, err + } + return &MessagingClient{ bootstrapBrokers: bootstrapBrokers, - } + grpcConnection: grpcConnection, + }, nil +} + +func (mc *MessagingClient) Shutdown() { + mc.grpcConnection.Close() } -- cgit v1.2.3