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

18th
Oct 2017
Jagmohan Sharma
@JagmohanSharma
Oct 18 2017 03:01
@spencergibb Thank you. :) @dsyer Actually I made changes and started pull request. Netflix/Hystrix#1698 this pull request includes fix for Netflix/Hystrix#1697
Victor Petit
@vpetit35
Oct 18 2017 08:52
Hello ! I have a app that does a context.stop() when a problem occurs, and a context.start() when problem is fixed. But it appears that Eureka after a while (few minutes), give up trying to register back that app and unregister it for ever (note that I use the enable-self-preservation: false). Is there a way that this app self (re-)register itself then ?
Dave Syer
@dsyer
Oct 18 2017 08:56
context.stop() is usually not reversible in general
Nothing to do with Eureka
No, wait, sorry.
Forget that.
I think it should work.
Does the status in Eureka change when you stop the context?
Victor Petit
@vpetit35
Oct 18 2017 09:02
yes
I wonder if something like "discoveryClient.registerHealthCheck(discoveryClient.getHealthCheckHandler());" would do the job ?
actualy the context.stop()/start() is mostly there with spring cloud stream to stop/start pick messages
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:41

Hi, I'm trying to register a service in eureka with a different name than its spring.application.name. I'm using eureka.instance.appName and it works for Eureka, but Zuul doesn't seem to like it, it returns
com.netflix.zuul.exception.ZuulException: Forwarding error.... Load balancer does not have available server for client: microservice-v2

Is there anything else that needs to be changed for zuul to route correctly?
This is what I see in eureka:

<application>
<name>MICROSERVICE-V2</name>
<instance>
<instanceId>296111bf8634:microservice:9000</instanceId>
<hostName>xx.xx.xx.xx</hostName>
<app>MICROSERVICE-V2</app>
<ipAddr>xx.xx.xx.xx</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">9000</port>
<securePort enabled="false">443</securePort>

and zuul's /routes

"/microservice-v2/**": "microservice-v2"
Just found this as well, in Zuul /health, I can see my v2 in discoveryComposite.discoveryClient.services but not in eureka.applications
Dave Syer
@dsyer
Oct 18 2017 09:45
Don't know. Is "-" legal in an app name?
Does it work as "msv2"?
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:46
I have other services with -. I can try but I don't think that would be the issue
Dave Syer
@dsyer
Oct 18 2017 09:46
Doesn't seem likely to me either
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:47
Just theoretically, that what I'm trying to do should be feasible right?
Dave Syer
@dsyer
Oct 18 2017 09:47
What do you see in /eureka/apps?
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:48
the snippet above, I can see the service registered correctly
but vipAddress and secureVipAddress have still microservice in it, not v2
could that be the issue?
Dave Syer
@dsyer
Oct 18 2017 09:49
yes
I guess you have to configure those as well. By default they are all the same.
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:49
is there any property in the client I need to set to fix it?
ok, is it just eureka.instance.vipAddress? Let me try
Dave Syer
@dsyer
Oct 18 2017 09:51
I see "virtualHostName"
org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.virtualHostName
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 09:52
thanks! let me try that
Amin Abu-Taleb
@aabutaleb
Oct 18 2017 10:03
@dsyer it worked! thanks! :+1:
Andrew Regan
@poblish
Oct 18 2017 13:44
We have apps hooked-up to a Cloud Config server and able to pull down Vault secrets without needing to be Cloud Vault clients themselves (and thereby needing to be fully configured with Vault host, token, certs etc). But that stops us using SCV's configuration (spring.cloud.vault.mysql.role etc.) to pull passwords from Database backends. Anyone got any hints as to how we could use / extend our Config Server to request those dynamic secrets and expose them to Config clients, lease-aware just like other secrets? (Vault itself is fully provisioned)
Victor Petit
@vpetit35
Oct 18 2017 13:53
@dsyer well, any idea mb for my eureka registration issue ?
Dave Syer
@dsyer
Oct 18 2017 13:56
Try a /refresh after the start()?
But I don't really understand: eureka client is supposed to unregister on stop()
You could try and debug into EurekaAutoServiceRegistration and work out why it doesn't
Dave Syer
@dsyer
Oct 18 2017 14:01
Are you running with server.port=0 (I know that has caused issues with registration in the past)?
Victor Petit
@vpetit35
Oct 18 2017 14:01
it does, it unregister after stop(), but it does not re register after the start()
unless it is done quickly
Dave Syer
@dsyer
Oct 18 2017 14:02
It should happen on start()
Debug it. Check server.port.
Victor Petit
@vpetit35
Oct 18 2017 14:02
before eureka definetly consider him as dead
I am not using server.port=0 no
Ziemowit
@Ziemowit
Oct 18 2017 16:27

Hi guys!
Maybe you have met before with such a problem.
Seems that my understanding of SPRING-ZUUL is not correct.
I have 2 services: A (spring-zuul) and B. I use spring-sleuth together with them.

The problem is that spring-zuul duplicates headers: X-B3-TraceId & X-B3-SpanId (I have 2 the same headers with the same value). Because of that the B blows up on span extraction.

java.lang.IllegalArgumentException: Malformed id: c8282b341a304ef2, c8282b341a304ef2
    at org.springframework.cloud.sleuth.Span.hexToId(Span.java:602)

What is interesting if from A I will send request to B via @FeignClient (not using redirection by spring-zull) it works. Spans are passed correctly.
My configuration of A (spring-zuul) is:

zuul:
  routes:
    B:
      path: /service-b/**  # the redirection to service B
      sensitiveHeaders:
      strip-prefix: false

Eureka config:

eureka:
  instance:
    nonSecurePortEnabled: false
    securePortEnabled: true
    hostname: ${HOSTNAME}
    instance-id: ${eureka.instance.hostname}:${spring.application.name}

If you did not meet such a problem I will find the solution myself but maybe someone had similar problem?