Hi,
I have one Tyk Gateway and 2 docker containers of a REST test service (on 2 EC2 VM).
When I add a manual load balancing between the 2 containers it works perfectly.
But when a container shuts down, tyk continues trying to reach this service, so I decided to try “service discovery” with consul.io
I have a Consul cluster and in the service definition in the dashboard I keep the “Enable round-robin load balancing” checked and I clean the “Add LB targets” field.
I check “Enable service discovery” Query endpoint : http://XXX.XXX.XXX.XXX:8500/v1/catalog/service/chuckrest Does this endpoint return a list? : Checked Are the values nested? : Unchecked Data path : array.ServiceAddress Is port information separate from the hostname? Checked Port data path : array.ServicePort
When I try a REST call to the tyk endpoint I have an error :
Error distribution:
[100] Get http://XXX.XXX.XXX.XXX:8080/chuckrest/api/getrandomfact: EOF
This output is taken from an “ApacheBench like” container (Docker)
Basically, the service discovery client is really quite flexible and can handle a lot of different data types, isTargetList (I think, IRRC) will check if the target path is a list object instead of a map object, in which case it changes it’s behaviour.