Browse Source

filer master start up with default ip address instead of just localhost

pull/1293/head
Chris Lu 5 years ago
parent
commit
076c8bd3bc
  1. 2
      weed/command/benchmark.go
  2. 3
      weed/command/filer.go
  3. 1
      weed/command/master.go
  4. 2
      weed/command/server.go
  5. 4
      weed/filer2/filer.go
  6. 15
      weed/messaging/broker/broker_grpc_server_publish.go
  7. 47
      weed/messaging/broker/broker_server.go
  8. 25
      weed/messaging/client/client.go
  9. 70
      weed/messaging/client/publisher.go
  10. 10
      weed/pb/grpc_client_server.go
  11. 5
      weed/pb/messaging.proto
  12. 144
      weed/pb/messaging_pb/messaging.pb.go
  13. 3
      weed/server/filer_server.go
  14. 3
      weed/server/master_server.go
  15. 2
      weed/shell/commands.go
  16. 4
      weed/wdclient/masterclient.go

2
weed/command/benchmark.go

@ -127,7 +127,7 @@ func runBenchmark(cmd *Command, args []string) bool {
defer pprof.StopCPUProfile()
}
b.masterClient = wdclient.NewMasterClient(b.grpcDialOption, "client", 0, strings.Split(*b.masters, ","))
b.masterClient = wdclient.NewMasterClient(b.grpcDialOption, "client", "", 0, strings.Split(*b.masters, ","))
go b.masterClient.KeepConnectedToMaster()
b.masterClient.WaitUntilConnected()

3
weed/command/filer.go

@ -43,7 +43,7 @@ func init() {
cmdFiler.Run = runFiler // break init cycle
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", "", "filer server http listen ip address")
f.ip = cmdFiler.Flag.String("ip", util.DetectedHostAddress(), "filer server http listen ip address")
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")
@ -109,6 +109,7 @@ func (fo *FilerOptions) startFiler() {
DataCenter: *fo.dataCenter,
DefaultLevelDbDir: defaultLevelDbDirectory,
DisableHttp: *fo.disableHttp,
Host: *fo.ip,
Port: uint32(*fo.port),
Cipher: *fo.cipher,
})

1
weed/command/master.go

@ -172,6 +172,7 @@ func checkPeers(masterIp string, masterPort int, peers string) (masterAddress st
func (m *MasterOptions) toMasterOption(whiteList []string) *weed_server.MasterOption {
return &weed_server.MasterOption{
Host: *m.ip,
Port: *m.port,
MetaFolder: *m.metaFolder,
VolumeSizeLimitMB: *m.volumeSizeLimitMB,

2
weed/command/server.go

@ -45,7 +45,7 @@ var cmdServer = &Command{
}
var (
serverIp = cmdServer.Flag.String("ip", "localhost", "ip or server name")
serverIp = cmdServer.Flag.String("ip", util.DetectedHostAddress(), "ip or server name")
serverBindIp = cmdServer.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to")
serverTimeout = cmdServer.Flag.Int("idleTimeout", 30, "connection idle seconds")
serverDataCenter = cmdServer.Flag.String("dataCenter", "", "current volume server's data center name")

4
weed/filer2/filer.go

@ -40,10 +40,10 @@ type Filer struct {
metaLogReplication string
}
func NewFiler(masters []string, grpcDialOption grpc.DialOption, filerGrpcPort uint32, collection string, replication string, notifyFn func()) *Filer {
func NewFiler(masters []string, grpcDialOption grpc.DialOption, filerHost string, filerGrpcPort uint32, collection string, replication string, notifyFn func()) *Filer {
f := &Filer{
directoryCache: ccache.New(ccache.Configure().MaxSize(1000).ItemsToPrune(100)),
MasterClient: wdclient.NewMasterClient(grpcDialOption, "filer", filerGrpcPort, masters),
MasterClient: wdclient.NewMasterClient(grpcDialOption, "filer", filerHost, filerGrpcPort, masters),
fileIdDeletionQueue: util.NewUnboundedQueue(),
GrpcDialOption: grpcDialOption,
}

15
weed/messaging/broker/broker_grpc_server_publish.go

@ -28,6 +28,19 @@ func (broker *MessageBroker) Publish(stream messaging_pb.SeaweedMessaging_Publis
}
// send init response
initResponse := &messaging_pb.PublishResponse{
Config: nil,
Redirect: nil,
}
err = stream.Send(initResponse)
if err != nil {
return err
}
if initResponse.Redirect != nil {
return nil
}
// get lock
tp := TopicPartition{
Namespace: in.Init.Namespace,
@ -87,6 +100,8 @@ func (broker *MessageBroker) Publish(stream messaging_pb.SeaweedMessaging_Publis
Headers: in.Data.Headers,
}
println("received message:", string(in.Data.Value))
data, err := proto.Marshal(m)
if err != nil {
glog.Errorf("marshall error: %v\n", err)

47
weed/messaging/broker/broker_server.go

@ -2,11 +2,11 @@ package broker
import (
"context"
"fmt"
"time"
"google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
@ -34,7 +34,9 @@ func NewMessageBroker(option *MessageBrokerOption, grpcDialOption grpc.DialOptio
topicLocks: NewTopicLocks(),
}
go messageBroker.loopForEver()
messageBroker.checkPeers()
// go messageBroker.loopForEver()
return messageBroker, nil
}
@ -52,6 +54,8 @@ func (broker *MessageBroker) checkPeers() {
// contact a filer about masters
var masters []string
found := false
for !found {
for _, filer := range broker.option.Filers {
err := broker.withFilerClient(filer, func(client filer_pb.SeaweedFilerClient) error {
resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
@ -61,14 +65,20 @@ func (broker *MessageBroker) checkPeers() {
masters = append(masters, resp.Masters...)
return nil
})
if err != nil {
fmt.Printf("failed to read masters from %+v: %v\n", broker.option.Filers, err)
return
if err == nil {
found = true
break
}
glog.V(0).Infof("failed to read masters from %+v: %v", broker.option.Filers, err)
time.Sleep(time.Second)
}
}
glog.V(0).Infof("received master list: %s", masters)
// contact each masters for filers
var filers []string
found = false
for !found {
for _, master := range masters {
err := broker.withMasterClient(master, func(client master_pb.SeaweedClient) error {
resp, err := client.ListMasterClients(context.Background(), &master_pb.ListMasterClientsRequest{
@ -78,32 +88,21 @@ func (broker *MessageBroker) checkPeers() {
return err
}
fmt.Printf("filers: %+v\n", resp.GrpcAddresses)
filers = append(filers, resp.GrpcAddresses...)
return nil
})
if err != nil {
fmt.Printf("failed to list filers: %v\n", err)
return
}
}
// contact each filer about brokers
for _, filer := range filers {
err := broker.withFilerClient(filer, func(client filer_pb.SeaweedFilerClient) error {
resp, err := client.GetFilerConfiguration(context.Background(), &filer_pb.GetFilerConfigurationRequest{})
if err != nil {
return err
if err == nil {
found = true
break
}
masters = append(masters, resp.Masters...)
return nil
})
if err != nil {
fmt.Printf("failed to read masters from %+v: %v\n", broker.option.Filers, err)
return
glog.V(0).Infof("failed to list filers: %v", err)
time.Sleep(time.Second)
}
}
glog.V(0).Infof("received filer list: %s", filers)
broker.option.Filers = filers
}

25
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, error) {
grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.msg_client")
grpcConnection, err := pb.GrpcDial(context.Background(), "localhost:17777", grpcDialOption)
if err != nil {
return nil, err
}
func NewMessagingClient(bootstrapBrokers []string) *MessagingClient {
return &MessagingClient{
bootstrapBrokers: bootstrapBrokers,
grpcConnection: grpcConnection,
}, nil
}
func (mc *MessagingClient) Shutdown() {
mc.grpcConnection.Close()
}

70
weed/messaging/client/publisher.go

@ -1,14 +1,76 @@
package client
import "github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
import (
"context"
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
)
type Publisher struct {
publishClient messaging_pb.SeaweedMessaging_PublishClient
}
func (mc *MessagingClient) NewPublisher(namespace, topic string) (*Publisher, error) {
stream, err := messaging_pb.NewSeaweedMessagingClient(mc.grpcConnection).Publish(context.Background())
if err != nil {
return nil, err
}
func (c *MessagingClient) NewPublisher(namespace, topic string) *Publisher {
return &Publisher{}
// send init message
err = stream.Send(&messaging_pb.PublishRequest{
Init: &messaging_pb.PublishRequest_InitMessage{
Namespace: namespace,
Topic: topic,
Partition: 0,
},
})
if err != nil {
return nil, err
}
// process init response
initResponse, err := stream.Recv()
if err != nil {
return nil, err
}
if initResponse.Redirect != nil {
// TODO follow redirection
}
if initResponse.Config != nil {
}
// setup looks for control messages
doneChan := make(chan error, 1)
go func() {
for {
in, err := stream.Recv()
if err != nil {
doneChan <- err
return
}
if in.Redirect != nil{
}
if in.Config != nil{
}
}
}()
return &Publisher{
publishClient: stream,
}, nil
}
func (p *Publisher) Publish(m *messaging_pb.RawData) error {
return nil
return p.publishClient.Send(&messaging_pb.PublishRequest{
Data: m,
})
}
func (p *Publisher) Shutdown() {
p.publishClient.CloseSend()
}

10
weed/pb/grpc_client_server.go

@ -14,6 +14,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/pb/master_pb"
"github.com/chrislusf/seaweedfs/weed/pb/messaging_pb"
)
const (
@ -158,6 +159,15 @@ func WithMasterClient(master string, grpcDialOption grpc.DialOption, fn func(cli
}
func WithBrokerGrpcClient(brokerGrpcAddress string, grpcDialOption grpc.DialOption, fn func(client messaging_pb.SeaweedMessagingClient) error) error {
return WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
client := messaging_pb.NewSeaweedMessagingClient(grpcConnection)
return fn(client)
}, brokerGrpcAddress, grpcDialOption)
}
func WithFilerClient(filer string, grpcDialOption grpc.DialOption, fn func(client filer_pb.SeaweedFilerClient) error) error {
filerGrpcAddress, parseErr := ParseServerToGrpcAddress(filer)

5
weed/pb/messaging.proto

@ -74,11 +74,6 @@ message PublishRequest {
int32 partition = 3;
}
InitMessage init = 1;
message RawData {
bytes key = 1; // Message key
bytes value = 2; // Message payload
map<string, bytes> headers = 3; // Message headers
}
RawData data = 2;
}

144
weed/pb/messaging_pb/messaging.pb.go

@ -283,7 +283,7 @@ func (m *BrokerMessage_RedirectMessage) GetNewBroker() string {
type PublishRequest struct {
Init *PublishRequest_InitMessage `protobuf:"bytes,1,opt,name=init" json:"init,omitempty"`
Data *PublishRequest_RawData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
Data *RawData `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
}
func (m *PublishRequest) Reset() { *m = PublishRequest{} }
@ -298,7 +298,7 @@ func (m *PublishRequest) GetInit() *PublishRequest_InitMessage {
return nil
}
func (m *PublishRequest) GetData() *PublishRequest_RawData {
func (m *PublishRequest) GetData() *RawData {
if m != nil {
return m.Data
}
@ -337,38 +337,6 @@ func (m *PublishRequest_InitMessage) GetPartition() int32 {
return 0
}
type PublishRequest_RawData struct {
Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
Headers map[string][]byte `protobuf:"bytes,3,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (m *PublishRequest_RawData) Reset() { *m = PublishRequest_RawData{} }
func (m *PublishRequest_RawData) String() string { return proto.CompactTextString(m) }
func (*PublishRequest_RawData) ProtoMessage() {}
func (*PublishRequest_RawData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4, 1} }
func (m *PublishRequest_RawData) GetKey() []byte {
if m != nil {
return m.Key
}
return nil
}
func (m *PublishRequest_RawData) GetValue() []byte {
if m != nil {
return m.Value
}
return nil
}
func (m *PublishRequest_RawData) GetHeaders() map[string][]byte {
if m != nil {
return m.Headers
}
return nil
}
type PublishResponse struct {
Config *PublishResponse_ConfigMessage `protobuf:"bytes,1,opt,name=config" json:"config,omitempty"`
Redirect *PublishResponse_RedirectMessage `protobuf:"bytes,2,opt,name=redirect" json:"redirect,omitempty"`
@ -551,7 +519,6 @@ func init() {
proto.RegisterType((*BrokerMessage_RedirectMessage)(nil), "messaging_pb.BrokerMessage.RedirectMessage")
proto.RegisterType((*PublishRequest)(nil), "messaging_pb.PublishRequest")
proto.RegisterType((*PublishRequest_InitMessage)(nil), "messaging_pb.PublishRequest.InitMessage")
proto.RegisterType((*PublishRequest_RawData)(nil), "messaging_pb.PublishRequest.RawData")
proto.RegisterType((*PublishResponse)(nil), "messaging_pb.PublishResponse")
proto.RegisterType((*PublishResponse_ConfigMessage)(nil), "messaging_pb.PublishResponse.ConfigMessage")
proto.RegisterType((*PublishResponse_RedirectMessage)(nil), "messaging_pb.PublishResponse.RedirectMessage")
@ -802,58 +769,57 @@ var _SeaweedMessaging_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("messaging.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 847 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xcd, 0x8e, 0xe3, 0x44,
0x10, 0xde, 0x8e, 0x33, 0x93, 0x75, 0xe5, 0x97, 0x16, 0x83, 0x22, 0x33, 0x03, 0x96, 0x77, 0x25,
0x02, 0x23, 0xac, 0x21, 0x5c, 0xc2, 0x6a, 0x25, 0x94, 0x84, 0xb0, 0x44, 0x4c, 0x20, 0xea, 0xe4,
0x8a, 0xa2, 0x8e, 0xd3, 0x9b, 0xb5, 0x92, 0xd8, 0xc6, 0xdd, 0x21, 0xda, 0x13, 0x07, 0xb8, 0x72,
0xe2, 0x1d, 0xb8, 0x70, 0xe6, 0xc2, 0x8d, 0x07, 0xe0, 0x9d, 0x90, 0x7f, 0x63, 0x27, 0x1e, 0xef,
0x10, 0xed, 0xdc, 0xec, 0x72, 0xd5, 0x57, 0xf5, 0x55, 0x7d, 0xd5, 0x6e, 0xa8, 0x6f, 0x18, 0xe7,
0x74, 0x69, 0x5a, 0x4b, 0xdd, 0x71, 0x6d, 0x61, 0xe3, 0x4a, 0x6c, 0x98, 0x39, 0x73, 0xed, 0x97,
0x22, 0xbc, 0x33, 0xd9, 0xce, 0xb9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, 0xb5, 0xd1, 0x0d,
0xc2, 0x77, 0x50, 0x8e, 0x86, 0x1d, 0x5f, 0x9e, 0x3a, 0x2a, 0xd4, 0xab, 0x93, 0x1b, 0x12, 0xb1,
0x7d, 0x0f, 0xf5, 0xec, 0x2c, 0xe0, 0x17, 0x59, 0xb7, 0xdc, 0xf1, 0x55, 0x3f, 0x3a, 0x0d, 0x8a,
0x43, 0x60, 0x0f, 0x2e, 0x72, 0x9b, 0x8f, 0x0f, 0xae, 0x37, 0xa7, 0xa6, 0x4e, 0xbd, 0x7e, 0x12,
0x36, 0x8e, 0xd9, 0xd3, 0xa1, 0xc9, 0xc3, 0x2e, 0xbc, 0xe1, 0x86, 0xb9, 0xb6, 0x98, 0x2d, 0x7a,
0xf5, 0xa4, 0x21, 0x63, 0xff, 0x3e, 0x37, 0x2f, 0x05, 0xd7, 0xba, 0xcf, 0xff, 0x09, 0x00, 0x00,
0xff, 0xff, 0x14, 0x36, 0x4a, 0x4d, 0xe9, 0x09, 0x00, 0x00,
}

3
weed/server/filer_server.go

@ -45,6 +45,7 @@ type FilerOption struct {
DataCenter string
DefaultLevelDbDir string
DisableHttp bool
Host string
Port uint32
recursiveDelete bool
Cipher bool
@ -73,7 +74,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
glog.Fatal("master list is required!")
}
fs.filer = filer2.NewFiler(option.Masters, fs.grpcDialOption, option.Port+10000, option.Collection, option.DefaultReplication, fs.notifyMetaListeners)
fs.filer = filer2.NewFiler(option.Masters, fs.grpcDialOption, option.Host, option.Port, option.Collection, option.DefaultReplication, fs.notifyMetaListeners)
fs.filer.Cipher = option.Cipher
maybeStartMetrics(fs, option)

3
weed/server/master_server.go

@ -32,6 +32,7 @@ const (
)
type MasterOption struct {
Host string
Port int
MetaFolder string
VolumeSizeLimitMB uint
@ -93,7 +94,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
preallocateSize: preallocateSize,
clientChans: make(map[string]chan *master_pb.VolumeLocation),
grpcDialOption: grpcDialOption,
MasterClient: wdclient.NewMasterClient(grpcDialOption, "master", 0, peers),
MasterClient: wdclient.NewMasterClient(grpcDialOption, "master", option.Host, 0, peers),
}
ms.bounedLeaderChan = make(chan int, 16)

2
weed/shell/commands.go

@ -43,7 +43,7 @@ var (
func NewCommandEnv(options ShellOptions) *CommandEnv {
return &CommandEnv{
env: make(map[string]string),
MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, pb.AdminShellClient, 0, strings.Split(*options.Masters, ",")),
MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, pb.AdminShellClient, "", 0, strings.Split(*options.Masters, ",")),
option: options,
}
}

4
weed/wdclient/masterclient.go

@ -14,6 +14,7 @@ import (
type MasterClient struct {
clientType string
clientHost string
grpcPort uint32
currentMaster string
masters []string
@ -22,9 +23,10 @@ type MasterClient struct {
vidMap
}
func NewMasterClient(grpcDialOption grpc.DialOption, clientType string, clientGrpcPort uint32, masters []string) *MasterClient {
func NewMasterClient(grpcDialOption grpc.DialOption, clientType string, clientHost string, clientGrpcPort uint32, masters []string) *MasterClient {
return &MasterClient{
clientType: clientType,
clientHost: clientHost,
grpcPort: clientGrpcPort,
masters: masters,
grpcDialOption: grpcDialOption,

Loading…
Cancel
Save