Eureka Flashcards

1
Q

What is Eureka?

A

Eureka is a service discovery implementation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If spring-cloud-starter-netflix-eureka-client is on the classpath, are there any annotations needed to connect to a Eureka server?

A

No. A Eureka client automatically connects to http://localhost:8761/eureka/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

HTTP basic authentication is automatically added to your eureka client if one of the eureka.client.serviceUrl.defaultZone URLs has credentials embedded in it (curl style, as follows: user:password@localhost:8761/eureka).

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

By default, the EurekaClient bean is refreshable, meaning the Eureka client properties can be changed and refreshed. When a refresh occurs clients will be unregistered from the Eureka server and there might be a brief moment of time where all instance of a given service are not available. One way to eliminate this from happening is to disable the ability to refresh Eureka clients. To do this set eureka.client.refresh.enable=false.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If you want to run Eureka Client in AOT or native image modes, make sure to set spring.cloud.refresh.enabled to false

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

spring.application.name is used to give each microservice a virtual hostname, a name used by the Eureka server to identify each microservice. Eureka clients will use this virtual hostname in the URLs that are used to make HTTP calls to the microservice (e.g. http://service-a). This will only work if the HTTP client is load balanced

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What annotation is required on a configuration class to enable a Eureka server?

A

@EnableEurekaServer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The server has a home page with a UI and REST API endpoints for the normal Eureka functionality under /eureka/*

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Eureka implements client-side service discovery and Kubernetes implements server-side service discovery

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

By default, how often do Eureka clients send a heartbeat to the Eureka server?

A

Every 30 seconds

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Eureka clients have an in-memory cache of Eureka registrations so they do not have to go to the registry for every request to a service

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

By default, every Eureka server is also a Eureka client and requires (at least one) service URL to locate a peer. If you do not provide it, the service runs and works, but it fills your logs with a lot of noise about not being able to register with the peer. To prevent this, you can run a standalone Eureka server with the following properties:

eureka:
  client:
    register-with-eureka: false
    fetch-registry: false
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A standalone Eureka server is fairly resilient to failure as long as there is some sort of monitor or elastic runtime (such as Cloud Foundry) keeping it alive

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Eureka can be made even more resilient and available by running multiple instances and asking them to register with each other. In fact, this is the default behavior, so all you need to do to make it work is add a valid serviceUrl to a peer, as shown in the following example:

---
spring:
  profiles: peer1
eureka:
  instance:
    hostname: peer1
  client:
    serviceUrl:
      defaultZone: https://peer2/eureka/

---
spring:
  profiles: peer2
eureka:
  instance:
    hostname: peer2
  client:
    serviceUrl:
      defaultZone: https://peer1/eureka/
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

You can add multiple Eureka server peers to a system, and as long as they are all directly connected to each other, they will synchronize the registrations amongst themselves.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly