Consul GRPC 健康检查失败问题
資深大佬 : wunonglin 4
Consul 注册的信息
reg := api.AgentServiceRegistration{ ID: strconv.FormatInt(time.Now().UnixNano(), 10), Name: name, Address: listen, Port: port, Check: &api.AgentServiceCheck{ GRPC: fmt.Sprintf("%v:%v/%v", listen, port, name), Interval: "5s", Notes: "Consul check service health status.", DeregisterCriticalServiceAfter: "10s", }, }
我按照 https://www.consul.io/docs/discovery/checks 里的 grpc 检查里,写了个 proto
syntax = "proto3"; package grpc_health_v1; option go_package = ".;grpc_health_v1"; message HealthCheckRequest { string service = 1; } message HealthCheckResponse { enum ServingStatus { UNKNOWN = 0; SERVING = 1; NOT_SERVING = 2; SERVICE_UNKNOWN = 3; // Used only by the Watch method. } ServingStatus status = 1; } service Health { rpc Check(HealthCheckRequest) returns (HealthCheckResponse); rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse); }
我用 BloomRPC 和自己写的 client 都能正常访问这个 Check 方法,但是注册上了 Consul 却显示失败
大佬有話說 (7)