codecentric / spring-boot-admin

Admin UI for administration of spring boot applications
Apache License 2.0
12.38k stars 3.08k forks source link

Spring Boot Admin lists redundant applications #409

Closed HRPatel2000 closed 7 years ago

HRPatel2000 commented 7 years ago

Context

We have Spring Boot Admin Version 1.4.5 We also use Zuul Proxy 1.2.5.RELEASE for Proxy

We have 3 Applications (Microservices with multiple REST end points) as mentioned below,

All these applications are deployed on the same VM with Spring Boot Admin.

Problem

When we start the Spring Boot Admin and all other Applications, they are being auto-discovered and registered in the Admin. So, Spring Boot Admin Console shows the list of Applications as below,

But after a few mins, Spring Boot Admin gets more instances of the same Applications registered and now, we can see the Duplicate instances of the same Applications on Spring Boot Admin Console as mentioned below,

We then verify and make sure how many instances of each Application are running on the VM. And surprisingly we find only ONE for each Application.

Other Observation is, duplicate listing of each Application on the Spring Boot Admin shows little bit differently. One Instance shows HOSTNAME (As mentioned in the Spring Boot Admin's application.yml for that application) Other Instance shows IP ADDRESS (That was never really mentioned anywhere)

So, looks like either the Spring Boot Admin OR the individual Applications register behind the scene using IP ADDRESS.

Also, All the Applications work perfectly fine although they are showing up duplicated on the Spring Boot Admin Console. Also, each one of them creates only ONE Log File which means the listing on the Spring Boot Admin Console is redundant as in real, there is only ONE Instance for each Application that is running on the VM.

MORE INFORMATION

We can provide the Code Snippet of any Application Config or Spring Boot Admin per request. Screenshots of Spring Boot Admin Console showing multiple Application Instances are below,

Duplicate App Instances 1

Duplicate App Instances 2

joshiste commented 7 years ago

Weird. Are you using Discover additional to spring-boot-admin-starter-client?

HRPatel2000 commented 7 years ago

Thanx for your quick comment Johannes.

Here is what we have,

Spring Boot Admin's application.yml ` spring: profiles: dev

zuul: routes: lookups: url: http://${spring.adminServer.hostname}:20020/ews/lookups products: url: http://${spring.adminServer.hostname}:20021/ews/products visitors: url: http://${spring.adminServer.hostname}:20022/ews/visitors `

Spring Boot Admin's Application.java ` @Configuration @EnableAutoConfiguration @EnableAdminServer @EnableDiscoveryClient @EnableZuulProxy @SpringBootApplication public class AdminApplication {

private static final Logger LOGGER = LoggerFactory.getLogger(AdminApplication.class);

public static void main(String[] args) {

    LOGGER.info("Spring.Profiles.Active :-> " + System.getProperty("spring.profiles.active"));

    SpringApplication.run(AdminApplication.class, args);

    LOGGER.info("Started ADMIN Console/Catalog...");
}

} `

Individual Application's application.yml spring: profiles: dev boot: admin: url: http://${spring.adminServer.hostname}:8761 client: name: LOOKUPS url: http://${spring.adminServer.hostname}:20020 Individual Application's Application.java ` @SpringBootApplication public class LookupApplication {

private static final Logger LOGGER = LoggerFactory.getLogger(LookupApplication.class);

public static void main(String[] args) {

    LOGGER.info("Spring.Profiles.Active :-> " + System.getProperty("spring.profiles.active"));

    SpringApplication.run(LookupApplication.class, args);

    LOGGER.info("Started Lookups Microservice...");
}

} `

So, do you think the spring.boot.admin.url AND spring.boot.admin.client.* properties set in Client (Individual Application) side does the redundant registration?

joshiste commented 7 years ago

Either you should use @DiscoveryClient in your admin server and clients or add the spring-boot-admin-starter-client to your clients but not both, that's why your application gets registered twice. One time via discovery second time via the SBA client...

HRPatel2000 commented 7 years ago

@joshiste - We removed the bidirectional registration. So now, the only registration happens is from Client Applications via spring-boot-admin-starter-client. And @EnableDiscoveryClient has been removed from Spring Boot Admin. But still, precisely every midnight at 12 AM, all the Client Apps get re-registered.

Does any event occur by default periodically in Spring Boot Admin or spring-boot-admin-starter-client that would be giving this behavior???

So, to summarize, we still see duplicate Apps and precisely every midnight a redundant instance gets registered.

Any clues or suggestions?

joshiste commented 7 years ago

The spring-boot-admin-starter-client does a registering POST requests every 30s by default. I have no idea why they all reregister at 12 AM... Eventually your operators restart the apps every night from a different host or such? I guess the easiest way to find out is to do some network traces to find out who sends the requests...

SoberChina commented 7 years ago

I have the same question,I need you hellp.Thanks very much.

joshiste commented 7 years ago

@SoberChina you must not use spring-boot-admin-starter-client and spring-cloud-discovery at the same time, just choose one of them!

SoberChina commented 7 years ago

@joshiste ok , thank you very much .

AnissD commented 4 years ago

I have the same question . The only difference is that my services are recorded twice (uppercase and lowercase ). Need help.

githubyong commented 2 years ago

I have the same question.spring-boot-admin-server-2.3.1 and spring-boot 2.3.12. so how to solve it?

erikpetzold commented 2 years ago

@githubyong you must not use spring-boot-admin-starter-client and spring-cloud-discovery at the same time, just choose one of them!