-
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
Changing status on Eureka instance affects all instances on same host #63
Comments
Don't know. But /v2 is not used as a prefix any more, it's now /eureka by default. Did you change it or would an upgrade be a good idea? Also "MYHOST57" doesn't match the service id in the UI (not sure if that matters but it looks wrong). |
Aha, didn't know about the I can send you my sample code if you want? PS. About the "MYHOST57", it's a typo. |
Found these issues at Netflix Eureka: Hostname reused as InstanceId disallows multiple service instances on 1 host Added the UniqueIdentifier interface How can I supply a custom Here's how to do it without Spring: DiscoveryManager.getInstance().initComponent(
new MyDataCenterInstanceConfig("myNamespace.", new MyDataCenterInfo()),
new DefaultEurekaClientConfig()); |
How are your client apps registering? If they are Spring Cloud apps they should have unique ids already (we have samples that work on localhost just fine). If you need to customize the |
My client app has the following config: @Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient
public class SampleEurekaService {
....
} And my
|
Based on that, I'd expect the Eureka ID to be "MYHOST57:sample-eureka-service-8042:8042". Are you messing around with the |
Here's my complete Eureka client application (manually wiring the @Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient
public class SampleEurekaService {
private static final String DISCOVERY_CLIENT_BEAN_NAME = "discoveryClient";
@Autowired
private DiscoveryClient discoveryClient;
public static void main(String[] args) {
final ConfigurableApplicationContext context = SpringApplication.run(
SampleEurekaService.class, args);
final DiscoveryClient discoveryClient = context.getBean(
DISCOVERY_CLIENT_BEAN_NAME, DiscoveryClient.class);
discoveryClient.registerHealthCheck(new DefaultHealthCheckHandler());
}
} |
OK, I see what's happening. The sample apps have something like this:
I guess we need to maybe promote that to a default, but you can follow the same pattern to get your instances to show up as different IDs in Eureka. |
Adding this to my config and I cannot longer call:
According to Do you know how I can call the status URL using the suggested pattern for |
Ok, I got it:
Would be great to have this Thanks! |
I just saw this is my log when closing service:
When closing it does not use the |
Interesting. Maybe that explains some of the problems reported in #47. |
The problem manifests itself as errors in the Eureka server log (gh-47), but originates in the client because it is sending requests to /eureka/apps/{NAME}/{ID} with the wrong ID. The InstanceInfo has an ID that is derived (for preference) from the EurekaInstanceConfig.dataCenterInfo, so that's the best way to fix it. See gh-63, Fixes gh-47
Found another issue related to this. If using the feature Is this something that could be done by checking if the I'm currently using following pattern to make unique
|
That might be the best solution when server.port=0 (the actual port is not known until the container starts which is after the application context gets its ID, and the config beans are bound). We can certainly document this if it turns out to be best practice. Note that in Cloud Foundry there is a |
thanks Dave for pointing me out to this post, I'm able now to register multiple service instances by setting a metadata of eureka.instance.metadataMap.instanceId=${spring.application.name}:${spring.application.instance_id:${random.value}} thanks abaculus for the suggestion. |
Setup:
When invoking REST endpoint:
http://localhost:8761/v2/apps/SAMPLE-EUREKA-SERVICE-8042/MYHOST57/status?value=DOWN
, all service instances will change status to 'DOWN' on the same host.
What am I doing wrong?
Regards,
Andreas
The text was updated successfully, but these errors were encountered: