Member-only story

Spring Cloud Eureka Quick Start Demo

HBLOG
2 min readJul 16, 2024

--

1. What is Eureka?

Developed by Netflix, Eureka is a REST-based (Representational State Transfer) service for location services (service registration and discovery) to achieve load balancing and failover of middle-tier services, this service is called Eureka Server. It also comes with a Java-based client component, the Eureka Client, which makes it easier for clients to interact with Eureka Server. Here’s a simple service call:

  1. The service is registered with the Eureka Server by the service provider
  2. The service consumer obtains the real address of the service provider through the Eureka Server
  3. The service consumer calls the service with a real address

2. Code engineering

Purpose of the experiment

Set up an Eureka cluster

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>eureka</artifactId>
<groupId>com.et</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>eureka-server</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
<version>${eureka.version}</version>
</dependency>…

--

--

HBLOG
HBLOG

Written by HBLOG

talk is cheap ,show me your code

No responses yet

Write a response