[英]How to register python microservices with my eureka server (spring boot)
Inorder to register microservices with eureka server we need to add following config in our microservice为了向 eureka 服务器注册微服务,我们需要在我们的微服务中添加以下配置
eureka.client.service-url.defaultZone=${DISCOVERY_URL:http://localhost:8761}/eureka/
eureka.client.service-url.instance.leaseRenewalIntervalInSeconds=1
eureka.client.service-url.instance.leaseExpirationDurationInSeconds=1
But i need to create microservice in python and to register with eureka server.但是我需要在 python 中创建微服务并在 eureka 服务器上注册。 So how should i achieve?那么我应该如何实现呢?
Thanks in Advance提前致谢
Need to have REST implementation that follows Eureka-REST-operations .需要遵循Eureka-REST-operations 的REST 实现。 Below is a sample implementation that follow Eureka REST in Python.下面是在 Python 中遵循 Eureka REST 的示例实现。
Refer to full documentation at Python client for Netflix Eureka请参阅Netflix Eureka 的 Python 客户端的完整文档
from eureka.client import EurekaClient
import logging
logging.basicConfig()
ec = EurekaClient("MyApplication",
eureka_domain_name="test.yourdomain.net",
region="eu-west-1",
vip_address="http://app.yourdomain.net/",
port=80,
secure_vip_address="https://app.yourdomain.net/",
secure_port=443
)
print ec.get_zones_from_dns()
print ec.get_eureka_urls()
print ec.register()
print ec.update_status("UP") # Or ec.register("UP")
print ec.heartbeat()
The recommended github project by @AzizSM has not been updated in four years. @AzizSM 推荐的 github 项目已经四年没有更新了。 A more recent project is https://github.com/keijack/python-eureka-client .最近的一个项目是https://github.com/keijack/python-eureka-client 。 It was last updated in November 2019.它最后一次更新是在 2019 年 11 月。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.