Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Spring Cloud's highly available service registry

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article focuses on "how to use Spring Cloud's highly available service registry". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use Spring Cloud's highly available service registry.

I. preparatory work

Continue to use the previous project, there is a little interlude, because you do not intend to modify the hosts file to achieve a single server service cluster, do not understand it for a day, and finally come to a conclusion: a single server has to modify hosts, and multiple servers can be configured through ip.

Modify hosts: C:\ Windows\ System32\ drivers\ etc

Add a few lines at the end of the file:

2. Modify the project erurekaserver

1. Create a new application-one.yml

Server: port: 8761spring: application: name: eurekaserver profiles: oneeureka: instance: hostname: localhost1 client: register-with-eureka: true fetch-registry: true serviceUrl: defaultZone: http://localhost2:8861/eureka/ server: enableSelfPreservation: false

2. Create a new application-two.yml

Server: port: 8861spring: application: name: eurekaserver profiles: twoeureka: instance: hostname: localhost2 client: register-with-eureka: true fetch-registry: true serviceUrl: defaultZone: http://localhost1:8761/eureka/ server: enableSelfPreservation: false

3. Modify startup items

EurekaServerApplication.java right-> Run As-> Run Configruations.. Create two launch applications

4. Start one two respectively

When starting, there is always a background will report an error, and so on after the startup is complete. Visit http://localhost:8761/ and http://localhost:8861/ respectively, and the results are as follows:

Third, modify the config-server project

1. Modify application.properties, red box marking part

2. Start config-server

4. Modify the bootstrap.yml of eurekaclient1

Start the project

Modify the application.yml of service-ribbon

Start the project

6. Visit http://localhost:8761/ and http://localhost:8861/ again

7. Visit http://localhost:8764/hello

Can be accessed successfully.

At this point, I believe you have a deeper understanding of "how to use Spring Cloud's highly available service registry". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report