# springdemos
**Repository Path**: KANADEXD980224/springdemos
## Basic Information
- **Project Name**: springdemos
- **Description**: No description available
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2019-05-20
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# springdemos
Eureka-->服务注册与发现
ribbon-->负载均衡
负载均衡:把请求分散处理。
集群: 服务器集群就是指将很多服务器集中起来一起
进行同一种服务
,在客户端看来就像是只有一个服务器。
通过nginx可以实现集群。
集群是方式,负载均衡是目的。
架构:如何实现高可用?
横向:集群,所有服务器都提供一样的服务。
纵向:分布式。每台服务器可以提供不同的功能。
nginx--反向代理
打开EurekaServer地址
http://localhost:8080/
打开consumer测试的地址
http://localhost:9001/info
在consumer的controller里面,通过RestTemplate调用了EurekaClient的controller并且拿到返回值
return this.restTemplate.getForEntity("http://SERVER-PROVIDER/info", String.class).getBody();
测试RibbonConsumer:
http://localhost:9002/user/1
http://localhost:9002/user/
http://localhost:9002/user/add
http://localhost:9002/user/update
http://localhost:9002/user/delete/1
通过 pom 和 import实现了maven的多继承。 这种用法只能在dependencyManagement里面
org.springframework.cloud
spring-cloud-dependencies
Edgware.SR3
pom
import