In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to create SpringCloud's Eureka". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "how to create SpringCloud's Eureka" together.
1: Introduction to Eureka
Eureka is a sub-module of Spring Cloud Netflix and one of the core modules. For cloud service discovery, a REST-based service for location
Services for cloud middleware service discovery and failover.
Service Registration and Discovery
It is very important for microservice systems. With service discovery and registration, you don't have to change the configuration file of service invocation all day long, you only need to use the service ID
You can access the service. Its function is similar to dubbo's register.
Service discovery: Service discovery is one of the key principles of microservices infrastructure. Trying to get started configuring each client or convention of a certain format can be said to be very difficult and
Very fragile. Eureka is a service and client discovered by Netflix. This service is configurable and deployable by high availability and is registered when the service
The state of each service can be copied to each other.
Service registration: When a client registers with Eureka, it provides metadata about itself (such as host and port, health metrics URL, home page, etc.)
The service receives heartbeat information from each instance. If the heartbeat fails to be received for longer than the configured time, the instance will be removed from the registry normally
The following diagram shows basic service registration and discovery
II: Eureka Service Discovery and Registration (Create Registry)
1: Create a basic Spring Boot project and introduce the required dependencies in pom.xml
4.0.0 com.demo.springcloud eureka_register_service 1.0.0 jar eureka_register_service Spring Cloud project org.springframework.boot spring-boot-starter-parent 1.4.3.RELEASE UTF-8 1.8 org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-starter-eureka-server org.springframework.boot spring-boot-starter-security org.springframework.cloud spring-cloud-dependencies Brixton.RELEASE pom import org.springframework.boot spring-boot-maven-plugin
2: Create a startup class Application
package com.demo.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
Initiate a service registry with the @EnableEurekaServer annotation and make it available to other applications for conversation.
3: Create a configuration file application.properties. Be careful not to appear spaces. No start error
server.port=8000eureka.client.register-with-eureka=falseeureka.client.fetch-registry=falseeureka.client.serviceUrl.defaultZone=http://localhost:${server.port}/eureka/
4: Execute bluid.sh to build, then execute main method. Because I didn't compile manually under eclipse, I couldn't read it when I started
application.properties。
5: View Registry
http://127.0.0.1:8000/ can be seen as follows
Thank you for reading, the above is "SpringCloud Eureka how to create" content, after the study of this article, I believe that everyone has a deeper understanding of SpringCloud Eureka how to create this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.