Is it possible to integrate HAProxy
with Eureka
, so that Eureka Service Registry
serves as list of available servers for HAProxy
to load balance?
As per this HAProxy
can be configured to dynamically get list of available servers using name-servers? Can Eureka serve the purpose of a name-server?
Asked
Active
Viewed 993 times
1

Divs
- 1,578
- 2
- 24
- 51
-
Do you have multiple Eureka instances, that you want to access? Is that your use case? what exactly are you trying to do? – K.AJ Jun 14 '17 at 21:48
-
If you have multiple Eureka instances, you can use Eureka peering. https://stackoverflow.com/questions/30850232/how-to-config-multiple-eureka-servers-from-client-in-spring-cloud – K.AJ Jun 14 '17 at 21:50
-
As explained above, I want to check if `HAProxy` can get list of servers from `Eureka`? Other words, Can `HAPProxy` be treated as eureka-client? If Not, can eureka be treated as `Name-Server`? – Divs Jun 15 '17 at 06:24
-
I don't think it works that way. Eureka is an app, just like any other app on CF. So, the ip address for an instance of Eureka is, first local (i.e. 10.xxx), and second ephemeral. If that instance crashes for some reason, PCF will spin a new instance with a new ip. – K.AJ Jun 16 '17 at 15:15
1 Answers
0
Kinda late but still:
You can scrape app hostnames and ports from eureka's rest api and dynamically update your haproxy config and then reload.
- cronjob/systemd-timer to periodically call your config generation
script - systemctl reload haproxy.service
- profit

N. D.
- 311
- 2
- 8