Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can "spring.cloud.consul.host" config value have multiple Consul agents?

I'm a bit confused with this configuration. My Spring Boot app with @EnableDiscoveryClient has spring.cloud.consul.host set to localhost. I'm running a Consul Agent on the host where my Boot app is running, but I've a few questions (can't seem to find my answers in the documentation).

Can this config accept multiple values?

  • If so, I'd prefer to set the values to a list of Consul server addresses (but then, what's the point of running Consul Agents at all, so this doesn't seem practical, which means I'm not understanding something here)
  • If not, are we expected to run a Consul Agent on every node a Boot app with @EnableDiscoveryClient is running? (this feels wrong as well; for one, this would seem like a single point of failure even though one agent should be able to tell everything about the cluster; what if I can't contact this one agent?)
  • What's the best practice for this configuration?
like image 315
Srikanth Avatar asked Jan 30 '17 06:01

Srikanth


1 Answers

Actuallly this is Consul itself to solve your problem. An agent is runing on every server to handle clustering, failures, sharing data, autodiscovery etc. for you so that you don't neen to know the other hosts in your Spring Boot configuration. Spring Boot app always connects to the agent running on the same machine.

See https://www.consul.io/docs/agent/basics.html

like image 73
Piotr Gwiazda Avatar answered Oct 11 '22 19:10

Piotr Gwiazda