Skip to content
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

Why would eureka server return isAws false? #942

Closed
wimnat opened this issue May 15, 2017 · 9 comments
Closed

Why would eureka server return isAws false? #942

wimnat opened this issue May 15, 2017 · 9 comments

Comments

@wimnat
Copy link

wimnat commented May 15, 2017

I am seeking help in running Eureka server in AWS.

My config is currently very simple...

A springboot application annotated with @EnableEurekaServer running on an EC2 instance and configured with binding-strategy: eip. Unfortunately EIP binding is never attempted.

When I run the app I get a message in the log file on start up saying isAws: false but there is no detail as to why it thinks this. The app then continues to start successfully but without my EIP attachment as expected.

I have successfully run Eureka in AWS at a previous role I had and I didn't have to configure anything AWS specific.

There is a SO question that relates to this here http://stackoverflow.com/questions/43084285/eureka-server-cant-detect-aws but no replies. I really don't know where to go from here as the log provides no extra detail and I can query the ec2 metadata fine.

@qiangdavidliu
Copy link
Contributor

Hi @wimnat this looks related to spring cloud Netflix. I would advise to ask questions at https://github.com/spring-cloud/spring-cloud-netflix

@shmulika
Copy link

Hi @wimnat, did you follow up on this and got an answer?
Hope I'm not contaminating this forum

@wimnat
Copy link
Author

wimnat commented Jun 13, 2017

@shmulika - i posted an answer on the SO post

@shmulika
Copy link

Hi @wimnat and @qiangdavidliu , I think something is missing in the solution and I think it might still be related to Netflix/eureka original code/compatibility.

In order for Spring Netflix Eureka to return isAws true and bind to an EIP it seems to require this bean configured (as seen on several posts e.g. spring-cloud/spring-cloud-netflix#102):

   @Bean
    public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) {
        EurekaInstanceConfigBean b = new EurekaInstanceConfigBean(inetUtils);
        AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
        b.setDataCenterInfo(info);
        return b;
    }

This seemingly works nicely, isAws=true and the instance binds to the EIP. However, it does not take into consideration that the publicIpv4 address changes and enters a buggy state.
The instance still remembers the previous publicIpv4 address when checking if EIP is bound:
The function isEIPBound() at https://github.com/Netflix/eureka/blob/master/eureka-core/src/main/java/com/netflix/eureka/aws/EIPManager.java returns false (because it checks against the previous ipv4 address prior to the eip binding) and causes the registry to be cleared. This happens periodically at whatever interval EIP binding is checked.
If I restart the instance everythings starts working OK (because the instance has no state of the previous ipv4 adress).

If I understand correctly this is the result of the EurekaInstanceConfigBean and the DataCenterInfo being static.

@wimnat - did you encounter this also?
@qiangdavidliu - I assume Eureka can be made to detect AWS and learn the IPv4 including changes without this configuration? Or is this not part of the open source project?

Thanks!

@wimnat
Copy link
Author

wimnat commented Jun 18, 2017

I did not encounter this issue because I'm using an EIP. EIPs do not change. This is what the documentation states to do. Is there a particular reason you're not using an EIP?

@shmulika
Copy link

Sorry for not being clear enough - I AM using EIPs. But the very first time the instance comes up, the EC2 is still not bound to the EIP (it has some random IPv4 address until Eureka performs the binding to the EIP).
However, it is the first time that counts...

@wimnat
Copy link
Author

wimnat commented Jun 18, 2017 via email

@shmulika
Copy link

Please have a look at how it behaves on the first run (after once initially binding the EIP):

2017-06-15 14:05:46.528  INFO 1443 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-07a576cc81e58c0d3 seems to be already associated with the EIP 34.209.218.21
2017-06-15 14:06:46.312  INFO 1443 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-15 14:06:46.529  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2017-06-15 14:06:46.529  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2017-06-15 14:06:46.529  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2017-06-15 14:06:46.672  INFO 1443 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-07a576cc81e58c0d3 seems to be already associated with the EIP 34.209.218.21
2017-06-15 14:07:46.529  INFO 1443 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-15 14:07:46.673  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2017-06-15 14:07:46.673  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2017-06-15 14:07:46.673  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP
2017-06-15 14:07:46.738  INFO 1443 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-07a576cc81e58c0d3 seems to be already associated with the EIP 34.209.218.21
2017-06-15 14:08:46.674  INFO 1443 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-15 14:08:46.739  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Got 1 instances from neighboring DS node
2017-06-15 14:08:46.739  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Renew threshold is: 1
2017-06-15 14:08:46.739  INFO 1443 --- [ureka-EIPBinder] c.n.e.r.PeerAwareInstanceRegistryImpl    : Changing status to UP

This might look OK, but actually everytime this repeats the registry is completely cleared.

If I manually restart the Eureka instance (where EIP is already bounded by previous run), the log looks like this:

2017-06-14 11:47:10.019  INFO 4639 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-0fa10ad77743e213a seems to be already associated with the public ip 34.209.218.21
2017-06-14 11:47:10.025  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:48:10.025  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:49:10.025  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:50:10.025  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:51:10.026  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:52:10.020  INFO 4639 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-0fa10ad77743e213a seems to be already associated with the public ip 34.209.218.21
2017-06-14 11:52:10.026  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:53:10.026  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:54:10.027  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:55:10.027  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:56:10.027  INFO 4639 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry  : Running the evict task with compensationTime 0ms
2017-06-14 11:57:10.020  INFO 4639 --- [ureka-EIPBinder] com.netflix.eureka.aws.EIPManager        : My instance i-0fa10ad77743e213a seems to be already associated with the public ip 34.209.218.21

(Please don't put any order meaning to the dates, June 14th vs 15th, I've tested it many times over these are just the copy-pastes I've made)

The message from EIPBinder looks very similar, by indeed the first one reveals that the instance fails to verify that it's public ip is the same as the desired EIP; but then when trying to re-bind the EIP discovers that it is already bound...

@shmulika
Copy link

Hi,
After many Googling I've found a thread dealing with this exact issue:
spring-cloud/spring-cloud-netflix#1321
Thanks for the assist this far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants