-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document setting eureka instance id when running multiple local apps use 'server.port=0' #843
Comments
In case it helps... a pointer to the sample at the exact commit where I produced this problem (the fix is commented out). |
@kdvolder I think |
I tried using "local.server.port" but that didn't seem to work either (is there some property one could read that has the actual server port? If so, then that should be used. If there isn't... then maybe there should be :-) |
The trouble is, we don't know the port until the container has given it to spring boot, much later than when eureka needs it. |
But it seems Eureka does know the actual port somehow. Because the one instance that does get connected is accessible by clients that obtain a reference to it through Eureka. (I raised a bug about that being broken a while back... and you fixed that somehow). Isn't this a similar problem? Can't it be fixed the same way (however you did that piece of magic :-) Anyhow... I'm probably too naive as I have no idea how this stuff is all really wired together. I won't object if you think its too hard to fix and would rather opt to document it clearly. |
For instanceId, I think I'll stick to the documentation. :-) Running multiple instances on a single host with a random port, seems like an edge case and not likely to run in production. If someone is, it's a small bit of config. |
I'm facing the same issue. I got 2 servers in the same machine, also for test purposes, but Eureka can only see one. Here is my config
I have the feeling that even if deploy this app in multiple machines, I'll still see this problem, if this is related to the |
@spencergibb what do you think? |
Hi |
@felipeazv the problem is that both apps have the same instanceId which, by default uses |
@spencergibb big thanks! |
what is the differnt betwenn eureka with aws and eureka with netfix ? |
@kdvolder
@luizkowalski
|
Trying to run multiple local instances of a service for 'testing' purposes.
I set 'server.port=0' on my local app so that when I launch an instance it picks its own port. Convenient it you want to run more than one. And I would imagine this a good fit with Eureka too since i'd hope registering the instances with eureka they would then all become known to the clients of my service.
This all seems to work... except that if start more than one instance only one of the gets effectively registered with eureka.
I think the problem is the default instance id being picked is not unique:
Described here: http://cloud.spring.io/spring-cloud-static/spring-cloud.html#_eureka_metadata_for_instances_and_clients
It is an expression that contains "${server.port}" which evaluates to 0 regardles of what port was dynamically allocated.
Logically... I think this is wrong. It should not be using "server.port" but it should use the actual port the app is running on. If it did that, then it would all just work flawlessly without me having to configure something like this to fix this problem:
I'm not really sure this is a 'bug' or a 'feature'. But it seems incorrect to me to use 'server.port' when the intention is probably for this to be the port the app is actually running on, which it not if "server.port=0".
The text was updated successfully, but these errors were encountered: