In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to create a service registry in Java Spring Cloud". Many people will encounter this dilemma in the operation of practical cases. Let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Service registry: we will use service discovery and service registration, which is done with a single-node Eureka Server.
Two micro services: account service and customer service. Each microservice has its own database and exposes a simple responsive API for retrieving and storing data. In addition, customer service and account service can communicate with each other to get all of the customer's accounts and return them through the customer service API method.
Database: because few databases have available drivers for reactive data access, Spring Data Reactive currently supports only MangoDB, Redis, and Cassandra, so we use MangoDB for simplicity. I use Docker to create MangoDB here, and everything uses the default configuration (mainly lazy, so there is no need to change the Spring Boot configuration file)
Docker run-d-name mongo-p 27017 mongo operational Services Registration Centre
Create a new basic Spring Boot project, named eureka-server.
The dependent coordinates in pom.xml are as follows:
Org.springframework.cloud spring-cloud-starter-netflix-eureka-server
The configuration file application.yml is configured as follows:
Spring: application: name: eureka-servereureka: client: register-with-eureka: false fetch-registry: false service-url: defaultZone: http://localhost:8000/eureka/server: port: 8000
Add @ EnableEurekaServer annotation to the startup class
@ EnableEurekaServer@SpringBootApplicationpublic class EurekaServerApplication {public static void main (String [] args) {SpringApplication.run (EurekaServerApplication.class, args);}} "how Java Spring Cloud creates a service registry" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.