keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
184 stars 43 forks source link

Init only registers with first Eureka server #19

Closed dkrapohl closed 4 years ago

dkrapohl commented 4 years ago

I am unable to register my microservice with multiple Eureka registries using their registry init or just init. Here is the basic code: eureka_client.init(eureka_server="http://server1ip:8761/eureka/,http://server2ip:8761/eureka/", app_name=service_name, instance_port=service_port)

The IPs are correct (I can view the /eureka/apps endpoint on both). The code above only registers with the first Eureka server. Version info: py-eureka-client==0.7.2

keijack commented 4 years ago

Yes, it register to the first available node only, but when that node down, it will register to the second.

dinuta commented 4 years ago

Hi @dkrapohl Yes, it registers with the second in a round robin way. You can see from my tests. If the second goes down, it will go on the first, and so on ...

I think you are looking for eureka replication. Have a look at these tests and repo: https://github.com/dinuta/netflixoss-eureka https://github.com/dinuta/netflixoss-eureka/blob/master/tests/eureka_client_replication_test.py

And the docker-compose here: https://github.com/dinuta/netflixoss-eureka/blob/master/docker-compose.yml