grpc健康检查没有任何输出
来源:26-5 配置grpc的健康检查
cash666
2022-01-05
bobby老师,我 grpc配置好了健康检查(grpc_health包),但是在consul健康检查中没有任何输出,这个输出应该是grpc_health定义好的吧,请问下这个怎么解决?
from concurrent import futures
import logging
import grpc
from helloworld import helloworld_pb2
from helloworld import helloworld_pb2_grpc
from helloworld.common.grpc_health.v1 import health_pb2, health_pb2_grpc
from helloworld.common.grpc_health.v1 import health
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def SayHello(self, request, context):
return helloworld_pb2.HelloReply(message='Hello, %s!' % request.name)
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
helloworld_pb2_grpc.add_GreeterServicer_to_server(Greeter(), server)
# 注册健康检查
health_pb2_grpc.add_HealthServicer_to_server(health.HealthServicer(), server)
server.add_insecure_port('192.168.11.1:50051')
server.start()
server.wait_for_termination()
if __name__ == '__main__':
logging.basicConfig()
serve()
写回答
1回答
-
cash666
提问者
2022-01-05
解决了,自己的问题,配置check那一块,grpc后面不能用再用http的地址
00
相似问题