简体   繁体   English

如何在我的 eureka 服务器上注册 python 微服务(spring boot)

[英]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.

相关问题 Spring 引导服务器和 python 客户端使用 Websocket - Spring boot server and python client using Websocket 如何为微服务创建 Graphql 服务器? - How to create Graphql server for microservices? 如何从spring boot调用python程序? - How to call a python program from spring boot? 注册,注销,从python Web服务对eureka发现执行所有操作 - Register, Deregister, perform all operations on eureka discovery from python web-services 如何注册 64 位 python COM 服务器 - how to register a 64bit python COM server 如果python-socketio是我的项目的一部分,如何注册wsgi - How to register the wsgi if the python-socketio is a part of my project 如何让 Python 测试脚本自动注册到我的网站 - How make Python test script auto register for my site 如何结合 spring 引导和 python 3 创建 docker 文件 - How to create docker file combining with spring boot and python 3 第一个使用connexion + Flask + Swagger的python微服务出错 - Error in my first python microservices with connexion+Flask+Swagger 我们如何构建一个节点 api 它将向用户发送邮件并生成 otp 以访问我的 python 微服务 - How can we build a node api which will send mail to users and will also generate otp for accessing my python microservices
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM