当前位置:网站首页>Eureka cluster setup
Eureka cluster setup
2022-06-11 06:15:00 【Grumpy procedural ape】
preparation Because we use a computer to simulate , All we modify the computer etc Under folder host file Join in :
127.0.0.1 eureka8001.cn
127.0.0.1 eureka8002.cn
Our access to these two addresses is equivalent to accessing the local 127.0.0.1 route
The official start of the
To configure a cluster, you need to register multiple registries with each other Such as : stay 8001 Register in 8002 stay 8002 Register in 8001
Create two eureka The registry serves a port 8001 One port is 8002

8001pom rely on
<dependencies>
<!-- The new version eureka-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<artifactId>cloud-api-commons</artifactId>
<groupId>com.rpf.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
8001 yml Profile contents
server:
port: 8001
eureka:
instance:
hostname: eureka8001.cn
client:
register-with-eureka: false #false Does not register itself with the registry .
fetch-registry: false #false It means that its own end is the registration center , My job is to maintain service instances , There's no need to retrieve Services
service-url:
defaultZone: http:/eureka8002.cn:8002/eureka
8001 Start class
@SpringBootApplication
@EnableEurekaServer
public class EurekaMain8001 {
public static void main(String[] args) {
SpringApplication.run(EurekaMain8001.class,args);
}
}
8002pom rely on
<dependencies>
<!-- The new version eureka-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<artifactId>cloud-api-commons</artifactId>
<groupId>com.rpf.springcloud</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
8002yml The configuration file
server:
port: 8002
eureka:
instance:
hostname: eureka8002.cn
client:
register-with-eureka: false #false Does not register itself with the registry .
fetch-registry: false #false It means that its own end is the registration center , My job is to maintain service instances , There's no need to retrieve Services
service-url:
defaultZone: http:/eureka8001.cn:8001/eureka
8002 Start class
@SpringBootApplication
@EnableEurekaServer
public class EurekaMain8002 {
public static void main(String[] args) {
SpringApplication.run(EurekaMain8002.class,args);
}
}
Then we can start two projects
visit eureka8001.cn:8001
or
eureka8002.cn:8002
You can see that each other has registered their services
边栏推荐
- Devsecops in Agile Environment
- Shandong University machine learning experiment VI k-means
- SQLI_ LIBS range construction and 1-10get injection practice
- Compliance management 101: processes, planning and challenges
- NLP-D46-nlp比赛D15
- Which company is better in JIRA organizational structure management?
- What is a planning BOM?
- Login and registration based on servlet, JSP and MySQL
- The difference between call and apply and bind
- handler
猜你喜欢

A collection of problems on improving working frequency and reducing power consumption in FPGA design

Box model

Detailed steps for installing mysql-5.6.16 64 bit green version

Pycharm usage experience

Compliance management 101: processes, planning and challenges

What is a planning BOM?

Sqli-libs post injection question 11-17 actual combat
![Experimental report on information management and information system [information security and confidentiality] of Huazhong Agricultural University](/img/f6/e58196aeac85178f6603cea1962a6e.jpg)
Experimental report on information management and information system [information security and confidentiality] of Huazhong Agricultural University

Servlet

Can Amazon, express, lazada and shrimp skin platforms use the 911+vm environment to carry out production number, maintenance number, supplement order and other operations?
随机推荐
Cenos7 builds redis-3.2.9 and integrates jedis
Sword finger offer 32: print binary tree from top to bottom
Concepts and differences of parallel computing, distributed computing and cluster (to be updated for beginners)
Review XML and JSON
Compliance management 101: processes, planning and challenges
Box model
Global case | how Capgemini connects global product teams through JIRA software and confluence
Chapter 2 of machine learning [series] logistic regression model
go的fmt包使用和字符串的格式化
Devsecops in Agile Environment
Topic collection of FIFO minimum depth calculation
"All in one" is a platform to solve all needs, and the era of operation and maintenance monitoring 3.0 has come
URL in flask_ for
Sword finger offer 04: find in 2D array
Ethical discussion on reptile Technology
Sword finger offer 50: the first character that appears only once
Super explanation
What happened to the young man who loved to write code -- approaching the "Yao Guang young man" of Huawei cloud
那个酷爱写代码的少年后来怎么样了——走近华为云“瑶光少年”
SQLI_ LIBS range construction and 1-10get injection practice