In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-28 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 SpringCloud registry cluster". In the operation of practical cases, many people will encounter such a dilemma, so 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!
Cluster environment construction
Step 1: we build two new registry projects, one is called eureka_register_service_master, the other is called eureka_register_service_backup
The application.properties configuration for eureka_register_service_master is as follows:
Server.port=7998eureka.client.register-with-eureka=falseeureka.client.fetch-registry=falsespring.application.name=eureka-servereureka.instance.hostname=mastereureka.client.serviceUrl.defaultZone= http://backup:7999/eureka/# is configured with the address of backup.
The application.properties configuration for eureka_register_service_backup is as follows
Server.port=7999eureka.client.register-with-eureka=falseeureka.client.fetch-registry=falsespring.application.name=eureka-servereureka.instance.hostname=backup# what is configured here is the address of master, eureka.client.serviceUrl.defaultZone= http://master:7998/eureka/
The above configured ports are
Master port is 7998backupr port is 7999
Step 2: add startup files: ApplicationMaster.java,ApplicationBackUp.java
The content of the code is the same.
@ EnableEurekaServer@SpringBootApplicationpublic class ApplicationMaster {public static void main (String [] args) {SpringApplication.run (ApplicationMaster.class, args);}} @ EnableEurekaServer@SpringBootApplicationpublic class ApplicationBackUp {public static void main (String [] args) {SpringApplication.run (ApplicationBackUp.class, args);}}
Step 3: start
If it is jar startup, you need to add parameters-- spring.profiles.active=matser or-- spring.profiles.active=backup.
The first method is to start it through the jar command
Java-jar eureka_register_service_matser-1.0.0.jar-spring.profiles.active=matser java-jar eureka_register_service_backup-1.0.0.jar-spring.profiles.active=backup
The second is to start through eclipse right-click Run As.
Parameters need to be added as follows
Step 4: view the interface
Open http://127.0.0.1:7998/ and http://127.0.0.1:7999/ respectively as shown below
You can see it from the picture above.
Port 7998 is matser. Its registered-replicas points to http://backup:7999/eureka/.
Port 7999 is backup. Its registered-replicas points to http://master:7999/eureka/.
This is the end of the content of "how to create a SpringCloud registry cluster". 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.