博客
关于我
spring cloud入门,eureka服务注册和发现,ribbon负载均衡,hystrix熔断
阅读量:349 次
发布时间:2019-03-04

本文共 2975 字,大约阅读时间需要 9 分钟。

??????Spring Cloud??????

??????????????????????????????????????????????????????????????????????????????????

??????????

?????????????

  • ???????????????????????????
  • ???????????????????
  • ????????????????????
  • ?????????????????????

Spring Cloud?????

Spring Cloud???????????????????????????

1. ????????Eureka?

Eureka ?Spring Cloud??????????????????Eureka???????????????????????????????????

2. ???????Zuul?

Zuul????????????????????????????????????????????????????????????

3. ?????Ribbon?

Ribbon?????????????????????????????????????????????????????????????????

4. ???????Hystrix?

Hystrix?????????????????????Hystrix???????????????????????????????????

?????Eureka????

1. ??Eureka Server

  • POM???
  • org.springframework.cloud
    spring-cloud-starter-netflix-eureka-server
    1. ?????application.yml??
    2. server:  port: 8081eureka:  instance:    prefer-ip-address: true    hostname: leo-node  client:    register-with-eureka: false    fetch-registry: false    service-url:      defaultZone: http://${eureka.instance.hostname}:8082/eureka
      1. ????
      2. @SpringBootApplication@EnableEurekaServerpublic class EurekaServerApplication {    public static void main(String[] args) {        SpringApplication.run(EurekaServerApplication.class);    }}

        2. ????Eureka??

        ?IDE???????Eureka Server???????????????????????????????????Eureka??????????

        ????????Eureka???

        1. POM??

        org.springframework.cloud
        spring-cloud-starter-netflix-eureka-client

        2. ?????application.yml?

        eureka:  client:    service-url:      defaultZone: http://leo-node:8081/eureka    register-with-eureka: true    fetch-registry: trueserver:  port: 8091

        3. ???

        @SpringBootApplication@EnableEurekaClientpublic class ServiceProviderApplication {    public static void main(String[] args) {        SpringApplication.run(ServiceProviderApplication.class);    }}

        ????????Ribbon????

        1. POM??

        org.springframework.cloud
        spring-cloud-starter-netflix-ribbon

        2. ?????application.yml?

        eureka:  client:    service-url:      defaultZone: http://leo-node:8081/eurekaserver:  port: 9000

        3. ???????

        @Configurationpublic class RibbonConfig {    @LoadBalanced    @Bean    public RestTemplate restTemplate() {        return new RestTemplate();    }}

        4.CONTROLLER

        @RestController@RequestMapping("/consumer/ribbon")public class ConsumerController {    @Value("${server.port}")    private String port;    @Autowired    private RestTemplate restTemplate;    @RequestMapping("/sayHello")    public String test() {        return restTemplate.getForObject("http://service-provider-001/provider/sayHello", String.class);    }}

        ????

        ????????????????????????

      3. ??Eureka Server??????????????????
      4. ???????????????Eureka Server???????
      5. ??????????Ribbon?????????Hystrix???????????
      6. ????

        • ??????????????????Eureka Server?????????????
        • ???????Ribbon????????????????
        • ?????Hystrix????????????????????

        ???????????????Spring Cloud??????????????????????????

    转载地址:http://vyme.baihongyu.com/

    你可能感兴趣的文章
    Oracle GoldenGate Director安装和配置(无图)
    查看>>
    Oracle Goldengate在HP平台裸设备文件系统OGG-01028处理
    查看>>
    oracle instr函数详解
    查看>>
    Oracle Java所有版本的下载链接
    查看>>
    Oracle JDBC url的几种方式
    查看>>
    Oracle JDBC 连接卡死后 Connection Reset
    查看>>
    Oracle JDK vs OpenJDK
    查看>>
    ORACLE MERGE INTO (2)
    查看>>
    oracle ogg 单实例双向复制搭建(oracle-oracle)--Oracle GoldenGate
    查看>>
    Oracle ora-12514报错解决方法
    查看>>
    oracle ORA-14402 OGG-01296
    查看>>
    oracle package包头和package body包体例子
    查看>>
    oracle partition by list,深入解析partition-list 分区
    查看>>
    Oracle PL/SQL Dev工具(破解版)被植入勒索病毒的安全预警及自查通告
    查看>>
    oracle pl/sql 导出用户表结构
    查看>>
    Oracle PLSQL Demo - 17.游标查询个别字段(非整表)
    查看>>
    【C/C++学院】(6)构造函数/析构函数/拷贝构造函数/深copy浅copy
    查看>>
    oracle rac 安装 PRVG-13606 ntp 同步报错解决过程
    查看>>
    Oracle RAC性能调整的方案
    查看>>
    oracle rac集群的东西之QQ聊天
    查看>>