Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc_health_check not work #7518

Closed
kuangyuansheng opened this issue Jul 10, 2019 · 1 comment
Closed

grpc_health_check not work #7518

kuangyuansheng opened this issue Jul 10, 2019 · 1 comment
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@kuangyuansheng
Copy link

yaml

clusters: - name: xds_cluster
connect_timeout: { seconds: 5 }
type: STATIC
lb_policy: ROUND_ROBIN
http2_protocol_options: {}
hosts:
- socket_address: { address: 127.0.0.1, port_value: 18000 }
- socket_address: { address: 127.0.0.1, port_value: 17000 }
upstream_connection_options:
tcp_keepalive:
health_checks:
- grpc_health_check:
service_name: Health
unhealthy_threshold : 2
healthy_threshold: 3
timeout: 0.5s

service

package health
import(
"context"
pb "envoy-grpc/protos"
)
type Health struct{}
func New() *Health {
return &Health{}
}
func (h *Health) Check(ctx context.Context, in *pb.HealthCheckRequest) (*pb.HealthCheckResponse, error){
var s pb.HealthCheckResponse_ServingStatus = 1
return &pb.HealthCheckResponse{
Status : s,
}, nil
}
func (h *Health) Watch(in *pb.HealthCheckRequest, w pb.Health_WatchServer) (error){
var s pb.HealthCheckResponse_ServingStatus = 1
r := &pb.HealthCheckResponse{
Status : s,
}
for {
w.Send(r)
}
return nil
}

protobuf

syntax = "proto3";
package protobuf;
message HealthCheckRequest {
string service = 1;
}
message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
}
ServingStatus status = 1;
}
service Health {
rpc Check(HealthCheckRequest) returns (HealthCheckResponse);
rpc Watch(HealthCheckRequest) returns (stream HealthCheckResponse);
}

grpc_health_check not work
webwxgetmsgimg

When I run 18000, 17000 two ports, then turn off one of them, envoy will still be routed to the closed microservice, how to solve this problem

@alyssawilk alyssawilk added the question Questions that are neither investigations, bugs, nor enhancements label Jul 10, 2019
@kuangyuansheng
Copy link
Author

I have solved this problem, protobuf can only use package "google.golang.org/grpc/health/grpc_health_v1",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

2 participants