These are chat archives for spring-cloud/spring-cloud

8th
Jun 2016
Michael Rumpf
@mrumpf
Jun 08 2016 09:40
Hi, I'm not sure whether this is a Spring Cloud or Spring Boot topic. We are experiencing an issue with ignoring network interfaces in Spring cloud. I created an optimization ticket yesterday spring-cloud/spring-cloud-commons#114 and we thought we can work around by setting the VM parameter -Dspring.cloud.inetutils.ignoredInterfaces[0]=eth[^4]. Unfortunately the Spring Boot/Cloud initialization executes the InetUtils code 3 times. But in one iteration only, the ignoredInterfaces is taken into account :(

There is a very early initialization (I assume during bootstrap), where the VM parameter is not taken into account:
10:50:26.723 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth4
10:50:26.724 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth4
10:50:26.724 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth3
10:50:26.725 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth3
10:50:26.725 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth5
10:50:26.726 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth5
10:50:26.726 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: lo

Later, when the actual application context starts, I can see that the ignore parameter is used:
10:50:30.464 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth4
10:50:30.465 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth4
10:50:30.465 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth3
10:50:30.466 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Ignoring interface: eth3
10:50:30.466 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: eth5
10:50:30.467 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Ignoring interface: eth5
10:50:30.467 TRACE --- [ main] o.s.cloud.commons.util.InetUtils : Testing interface: lo

But then again it is not used:
10:50:51.416 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Testing interface: eth4
10:50:51.417 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth4
10:50:51.417 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Testing interface: eth3
10:50:51.418 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth3
10:50:51.418 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Testing interface: eth5
10:50:51.418 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Found non-loopback interface: eth5
10:50:51.419 TRACE --- [ XNIO-3 task-1] o.s.cloud.commons.util.InetUtils : Testing interface: lo
...

Dave Syer
@dsyer
Jun 08 2016 09:44
This change might help: spring-cloud/spring-cloud-commons@ff59dc8
Judging by comments from the OP on that issue you should be OK with that.
Michael Rumpf
@mrumpf
Jun 08 2016 09:47
Great! Thanks. Will try the 1.1.1.RELEASE version...
Daco
@dacofr
Jun 08 2016 22:36
Hi SpringCoudTeam, how i can set my listOfServers for only one specific service in a FeignClient interface
I've tried foo.ribbon.listOfServer=host:port but do not work
Then i add ribbon.eureka.enabled=false and now it work,
but now Eureka is disabled for all my FeignClient
Spencer Gibb
@spencergibb
Jun 08 2016 22:39
see http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_customizing_the_ribbon_client. You need to customize the foo ribbon client and create a ConfigurationBasedServerList
Daco
@dacofr
Jun 08 2016 22:48
Thanks, for the pointer @spencergibb but i don't want to make extra code. I just want override at runtime to make some test (for exemple).
blob
Spencer Gibb
@spencergibb
Jun 08 2016 22:50
don’t know what to tell you. writing code is the only way I know to make it happen. We do it all the time in our own tests.
Mauro Monti
@mmonti
Jun 08 2016 23:07
Hi guys, quick question. I am working with consul config, and I need to specify the connection to a consul cluster instead to one host. Can that be specified at application level or has to be done in the consul agent?
Spencer Gibb
@spencergibb
Jun 08 2016 23:08
the consul client only allows connections to one host. that should be configured in the agent and the client connects to the agent.
Mauro Monti
@mmonti
Jun 08 2016 23:09
got it... thanks!
Daco
@dacofr
Jun 08 2016 23:14

(sorry for my poor english). It's to make temporary test.
Imagine we have 4 services : S1, S2, S3, S4 that runs on remote servers. All are registered in Eureka.
Now i write an application that use the 4 services with 4 FeignClient interfaces. All works fine with just the attribut name in the FeignClient annotation.

Now to debug (or understand a problem), i temporay run S1 on my local machine and i want that my application connect to S1 that run on my localhost, but continue to connect to remote S2,S3,S4
I known that i can modify url attribut of FeignClient annotation, and then revert this change, but i just want to found a simple solution to explain to a developper how to tempory connect to a local service and not the remote listed in eureka by just changing system properties.

But if it's not possible, i will make differently

Spencer Gibb
@spencergibb
Jun 08 2016 23:20
Not easily. see http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_customizing_the_ribbon_client you could make multiple configurations that are activated by profiles. It’s something netflix has requested.
spring-cloud/spring-cloud-netflix#927
Daco
@dacofr
Jun 08 2016 23:24
Thanks, i'll look tomorow, i'm going to bed now :smile: