In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to build an Eureka service registration center. I think it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.
First create a Maven project, named eureka-server, and configure the dependency information for Eureka in pom.xml, as shown below.
Org.springframework.bootspring-boot-starter-parent2.0.6.RELEASEorg.springframework.cloudspring-cloud-starter-netflix-eureka-serverorg.springframework.cloudspring-cloud-dependenciesFinchley.SR2pomimport
Create a startup class, EurekaServerApplication, with the following code.
@ EnableEurekaServer@SpringBootApplicationpublic static void main (String [] args) {SpringApplication.run (EurekaServer Application.class, args);}}
The startup class mentioned here is almost exactly the same as the Spring Boot we talked about before, except that there is an @ EnableEurekaServer annotation to turn on EurekaServer.
Next, create an application.properties properties file under src/main/resources and add the following configuration:
Spring.application.name=eureka-server
Server.port=8761
# since the application is a registry, it is set to false, which means that you do not register yourself with the registry
Eureka.client.register-with-eureka=false
# since the registry is responsible for maintaining service instances, it does not need to retrieve services, so it is also set to false
Eureka.client.fetch-registry=false
Eureka.client.register-with-eureka must be configured as false, otherwise it will register itself as a client and report an error.
Then run EurekaServerApplication directly to start our registry service. If we configure port 8761 in application.properties, we can access it directly through http://localhost:8761/ to the browser, and then we will see the Web console provided by Eureka.
The above is how to build the Eureka service registration center. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.