成人无码视频,亚洲精品久久久久av无码,午夜精品久久久久久毛片,亚洲 中文字幕 日韩 无码

資訊專(zhuān)欄INFORMATION COLUMN

SpringCloud核心教程 | 第四篇:服務(wù)注冊(cè)與發(fā)現(xiàn) Consul篇

Xufc / 2158人閱讀

摘要:下一篇介紹基于的服務(wù)注冊(cè)與調(diào)用。服務(wù)提供者工程配置這里服務(wù)提供者是使用之前進(jìn)階教程第三篇整合連接池以及監(jiān)控改造而來(lái),這里一樣的部分就不再重復(fù)說(shuō)明,下面將說(shuō)明新增的部分。

Spring Cloud簡(jiǎn)介

Spring Cloud是一個(gè)基于Spring Boot實(shí)現(xiàn)的云應(yīng)用開(kāi)發(fā)工具,它為基于JVM的云應(yīng)用開(kāi)發(fā)中涉及的配置管理、服務(wù)發(fā)現(xiàn)、斷路器、智能路由、微代理、控制總線、全局鎖、決策競(jìng)選、分布式會(huì)話和集群狀態(tài)管理等操作提供了一種簡(jiǎn)單的開(kāi)發(fā)方式。

Spring Cloud包含了多個(gè)子項(xiàng)目(針對(duì)分布式系統(tǒng)中涉及的多個(gè)不同開(kāi)源產(chǎn)品),比如:Spring Cloud Config、Spring Cloud NetflixSpring Cloud CloudFoundry、Spring Cloud AWS、Spring Cloud Security、Spring Cloud CommonsSpring Cloud Zookeeper、Spring Cloud CLI等項(xiàng)目。

微服務(wù)架構(gòu)

“微服務(wù)架構(gòu)”在這幾年非常的火熱,以至于關(guān)于微服務(wù)架構(gòu)相關(guān)的開(kāi)源產(chǎn)品被反復(fù)的提及(比如: netflix、dubbo),Spring Cloud也因Spring社區(qū)的強(qiáng)大知名度和影響力也被廣大架構(gòu)師與開(kāi)發(fā)者備受關(guān)注。

那么什么是“微服務(wù)架構(gòu)”呢?簡(jiǎn)單的說(shuō),微服務(wù)架構(gòu)就是將一個(gè)完整的應(yīng)用從數(shù)據(jù)存儲(chǔ)開(kāi)始垂直拆分成多個(gè)不同的服務(wù),每個(gè)服務(wù)都能獨(dú)立部署、獨(dú)立維護(hù)、獨(dú)立擴(kuò)展,服務(wù)與服務(wù)間通過(guò)諸如RESTful API的方式互相調(diào)用。

對(duì)于“微服務(wù)架構(gòu)”,大家在互聯(lián)網(wǎng)可以搜索到很多相關(guān)的介紹和研究文章來(lái)進(jìn)行學(xué)習(xí)和了解。也可以閱讀始祖Martin Fowler的《Microservices》(中文版翻譯點(diǎn)擊查看),本文不做更多的介紹和描述。

服務(wù)治理

在簡(jiǎn)單介紹了Spring Cloud和微服務(wù)架構(gòu)之后,下面回歸本文的主旨內(nèi)容,如何使用Spring Cloud來(lái)實(shí)現(xiàn)服務(wù)治理。

由于Spring Cloud為服務(wù)治理做了一層抽象接口,所以在Spring Cloud應(yīng)用中可以支持多種不同的服務(wù)治理框架,比如:Netflix Eureka、Consul、Zookeeper。在Spring Cloud服務(wù)治理抽象層的作用下,我們可以無(wú)縫地切換服務(wù)治理實(shí)現(xiàn),并且不影響任何其他的服務(wù)注冊(cè)、服務(wù)發(fā)現(xiàn)、服務(wù)調(diào)用等邏輯。

所以,下面我們通過(guò)Eureka這種種服務(wù)治理的實(shí)現(xiàn)來(lái)體會(huì)Spring Cloud這一層抽象所帶來(lái)的好處。
下一篇介紹基于Consul的服務(wù)注冊(cè)與調(diào)用。

Spring Cloud Consul

首先,我們來(lái)嘗試使用Spring Cloud Consul來(lái)實(shí)現(xiàn)服務(wù)治理。

Consul 是一套開(kāi)源的分布式服務(wù)發(fā)現(xiàn)和配置管理系統(tǒng),由 HashiCorp 公司用 Go 語(yǔ)言開(kāi)發(fā)。

它具有很多優(yōu)點(diǎn)。包括: 基于 raft 協(xié)議,比較簡(jiǎn)潔; 支持健康檢查, 同時(shí)支持 HTTPDNS 協(xié)議 支持跨數(shù)據(jù)中心的 WAN 集群 提供圖形界面 跨平臺(tái),支持 Linux、Mac、Windows

下面,就來(lái)具體看看如何使用Spring Cloud Consul實(shí)現(xiàn)服務(wù)治理,這里使用Consul為服務(wù)注冊(cè)中心工程、consul-provider服務(wù)提供者工程、consul-consumer服務(wù)消費(fèi)者工程。

準(zhǔn)備工作

環(huán)境:

windows
jdk 8
maven 3.0
IDEA
構(gòu)建工程

首先構(gòu)建父工程,引入父工程依賴(lài):



    4.0.0
    
    
        cn.zhangbox
        spring-cloud-study
        1.0-SNAPSHOT
    
    
    cn.zhangbox
    spring-cloud-consul
    pom
    1.0-SNAPSHOT
    
    
    
        consul-provider
        consul-consumer
    
    

父工程取名為:spring-cloud-consul
構(gòu)建子工程,分別創(chuàng)建工程名為:、consul-provider、consul-consumer并在pom中加入以下依賴(lài):



    4.0.0

    
        cn.zhangbox
        spring-cloud-consul
        1.0-SNAPSHOT
    

    cn.zhangbox
    consul-provider
    0.0.1-SNAPSHOT
    jar

    consul-provider
    this project for Spring Boot

    
        UTF-8
        UTF-8
        1.8
        
        3.4
        1.10
        1.2.0
        1.16.14
        1.2.41
        1.1.2
    

    
        
        
            aliyunmaven
            http://maven.aliyun.com/nexus/content/groups/public/
        
    

    

        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            ${mybatis-spring-boot.version}
        
        

        
        
            org.springframework.cloud
            spring-cloud-starter-consul-discovery
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
        

        
        
            org.springframework.boot
            spring-boot-starter-web
        
        

        
        
            io.springfox
            springfox-swagger2
            2.6.1
        
        
            io.springfox
            springfox-swagger-ui
            2.6.1
        
        

        
        
            mysql
            mysql-connector-java
            runtime
        
        

        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        

        
        
            org.apache.commons
            commons-lang3
            ${commons-lang3.version}
        
        
            commons-codec
            commons-codec
            ${commons-codec.version}
        
        

        
        
            com.alibaba
            fastjson
            ${fastjson.version}
        
        

        
        
            com.alibaba
            druid-spring-boot-starter
            ${druid.version}
        
        

        
        
            org.projectlombok
            lombok
            ${lombok.version}
        
        
    

    
    
        
            
                org.springframework.cloud
                spring-cloud-dependencies
                Dalston.SR1
                pom
                import
            
        
    
    

    
        eureka-provider
        
            
            
                org.springframework.boot
                spring-boot-maven-plugin
            
            
        
    





    4.0.0

    
        cn.zhangbox
        spring-cloud-consul
        1.0-SNAPSHOT
    

    cn.zhangbox
    consul-consumer
    0.0.1-SNAPSHOT
    jar

    consul-consumer
    this project for Spring Boot

    
        UTF-8
        UTF-8
        1.8
        
        3.4
        1.10
        1.2.0
        1.16.14
        1.2.41
        1.1.2
    

    
        
        
            aliyunmaven
            http://maven.aliyun.com/nexus/content/groups/public/
        
    

    
        
        
            org.springframework.cloud
            spring-cloud-starter-consul-discovery
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
        

        
        
            org.springframework.cloud
            spring-cloud-starter-feign
        
        

        
        
            org.springframework.boot
            spring-boot-starter-web
        
        

        
        
            io.springfox
            springfox-swagger2
            2.6.1
        
        
            io.springfox
            springfox-swagger-ui
            2.6.1
        
        

        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        

        
        
            org.apache.commons
            commons-lang3
            ${commons-lang3.version}
        
        
            commons-codec
            commons-codec
            ${commons-codec.version}
        
        

        
        
            com.alibaba
            fastjson
            ${fastjson.version}
        
        

        
        
            org.projectlombok
            lombok
            ${lombok.version}
        
        
    

    
    
        
            
                org.springframework.cloud
                spring-cloud-dependencies
                Dalston.SR1
                pom
                import
            
        
    
    

    
        eureka-provider
        
            
            
                org.springframework.boot
                spring-boot-maven-plugin
            
            
        
    

工程構(gòu)建完成。

服務(wù)注冊(cè)中心搭建

Window下安裝:
window下安裝Consul
Linux下安裝:
CentOS 安裝 Consul 服務(wù)注冊(cè)和發(fā)現(xiàn)軟件
Consul安裝 linux環(huán)境
至此consul注冊(cè)中心創(chuàng)建完成,window下本機(jī)安裝的consul瀏覽器輸入地址:http://localhost:8500
linux下安裝的只需要把localhost換成對(duì)應(yīng)的ip即可
可以看到如下頁(yè)面,表示服務(wù)啟動(dòng)OK

這里這看到還沒(méi)有服務(wù)暴露出來(lái),是因?yàn)檫€沒(méi)創(chuàng)建服務(wù)提供者工程。

服務(wù)提供者工程配置

這里服務(wù)提供者是使用之前SpringBoot進(jìn)階教程 | 第三篇:整合Druid連接池以及Druid監(jiān)控改造而來(lái),這里一樣的部分就不再重復(fù)說(shuō)明,下面將說(shuō)明新增的部分。
首先:修改application.yml配置為如下:

#公共配置
server:
    port: 80
    tomcat:
      uri-encoding: UTF-8
spring:
  application:
      name: consul-provider
  #激活哪一個(gè)環(huán)境的配置文件
  profiles:
    active: dev
  #連接池配置
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    # 使用druid數(shù)據(jù)源
    type: com.alibaba.druid.pool.DruidDataSource
    druid:
      # 配置測(cè)試查詢(xún)語(yǔ)句
      validationQuery: SELECT 1 FROM DUAL
      # 初始化大小,最小,最大
      initialSize: 10
      minIdle: 10
      maxActive: 200
      # 配置一個(gè)連接在池中最小生存的時(shí)間,單位是毫秒
      minEvictableIdleTimeMillis: 180000
      testOnBorrow: false
      testWhileIdle: true
      removeAbandoned: true
      removeAbandonedTimeout: 1800
      logAbandoned: true
      # 打開(kāi)PSCache,并且指定每個(gè)連接上PSCache的大小
      poolPreparedStatements: true
      maxOpenPreparedStatements: 100
      # 配置監(jiān)控統(tǒng)計(jì)攔截的filters,去掉后監(jiān)控界面sql無(wú)法統(tǒng)計(jì),"wall"用于防火墻
      filters: stat,wall,log4j
      # 通過(guò)connectProperties屬性來(lái)打開(kāi)mergeSql功能;慢SQL記錄
      connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000

  #配置consul獲取服務(wù)地址,這里使用的是本地提供的注冊(cè)中心
  cloud:
    consul:
      #consul服務(wù)地址
      host: localhost
      #consul端口號(hào)
      port: 8500
      discovery:
        #配置注冊(cè)中心顯示當(dāng)前服務(wù)的ip
        prefer-ip-address: true
        #配置當(dāng)前服務(wù)的ip和端口號(hào)
        #instance-id: ${spring.cloud.client.ipAddress}:${server.port}
        #配置該項(xiàng)點(diǎn)擊ip會(huì)跳轉(zhuǎn)至對(duì)應(yīng)的接口swagger頁(yè)面
        health-check-url: http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html  # ${server.port}為該服務(wù)的端口號(hào)

#mybatis
mybatis:
  # 實(shí)體類(lèi)掃描
  type-aliases-package: cn.zhangbox.springboot.entity
  # 配置映射文件位置
  mapper-locations: classpath:mapper/*.xml
  # 開(kāi)啟駝峰匹配
  mapUnderscoreToCamelCase: true

---
#開(kāi)發(fā)環(huán)境配置
server:
  #端口
  port: 8080
spring:
  profiles: dev
  # 數(shù)據(jù)源配置
  datasource:
    url: jdbc:mysql://101.132.66.175:3306/student?useUnicode=true&characterEncoding=utf8&useSSL=false&tinyInt1isBit=true
    username: root
    password: 123456
#日志
logging:
  config: classpath:log/logback.xml
  path: log/consul-provider

---
#測(cè)試環(huán)境配置
server:
  #端口
  port: 80
spring:
  profiles: test
  # 數(shù)據(jù)源配置
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/consul-provider?useUnicode=true&characterEncoding=utf8&useSSL=false&tinyInt1isBit=true
    username: root
    password: 123456
#日志
logging:
  config: classpath:log/logback.xml
  path: /home/log/consul-provider

---
#生產(chǎn)環(huán)境配置
server:
  #端口
  port: 8080
spring:
  profiles: prod
  # 數(shù)據(jù)源配置
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/consul-provider?useUnicode=true&characterEncoding=utf8&useSSL=false&tinyInt1isBit=true
    username: root
    password: 123456
#日志
logging:
  config: classpath:log/logback.xml
  path: /home/log/consul-provider

其次:config目錄下增加SwaggerConfig類(lèi)加入以下代碼:

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket userApi() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.zhangbox.eureka.provider.controller"))//過(guò)濾的接口,有這掃描才會(huì)看到接口信息
                .paths(PathSelectors.any())
                .build();
        return docket;
    }


    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("eureka服務(wù)端提供者接口平臺(tái)").description("服務(wù)相關(guān)數(shù)據(jù)接口")
                .termsOfServiceUrl("http://www.zhang.box.cn/").contact("技術(shù)開(kāi)發(fā)部")
                .license("Licence Version 1.0").licenseUrl("#").version("1.0").build();
    }

}

這里如果不會(huì)使用swagger的整合可以參考這篇文章:
SpringBoot非官方教程 | 第十一篇:SpringBoot集成swagger2,構(gòu)建優(yōu)雅的Restful API

接著:創(chuàng)建核心啟動(dòng)類(lèi):

@EnableDiscoveryClient //使用該注解將注冊(cè)服務(wù)到consul
@SpringBootApplication
@MapperScan("cn.zhangbox.consul.provider.dao")//配置mybatis接口包掃描
public class ConsulProviderApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(ConsulProviderApplication.class, args);
    }
}

至此consul-provider服務(wù)提供者創(chuàng)建完成,瀏覽器輸入地址:http://localhost:8500/
可以看到如下頁(yè)面,表示服務(wù)注冊(cè)O(shè)K

瀏覽器輸入地址:http://localhost:8080/swagger-ui.html后可以跳轉(zhuǎn)看到swagger的頁(yè)面并可是測(cè)試服務(wù)提供者的接口,如下:

服務(wù)消費(fèi)者工程配置

這里構(gòu)建的工程名為consul-consumer,上文已經(jīng)構(gòu)建了工程但是沒(méi)有創(chuàng)建目錄,這里只需要在java目錄下創(chuàng)建configcontroller,service,包即可,這里服務(wù)的消費(fèi)是通過(guò)feign來(lái)進(jìn)行服務(wù)調(diào)用的,后面會(huì)有專(zhuān)門(mén)以篇文章來(lái)講feign。
首先:consul-consumer工程下resource目錄下添加application.yml文件并加入以下配置:

#公共配置
server:
    port: 80
    tomcat:
      uri-encoding: UTF-8
spring:
  #服務(wù)名稱(chēng),更關(guān)鍵,使用feign進(jìn)行服務(wù)消費(fèi)將以此為依據(jù)
  application:
        name: consul-consumer
  #激活哪一個(gè)環(huán)境的配置文件
  profiles:
    active: dev

  #配置consul獲取服務(wù)地址,這里使用的是本地提供的注冊(cè)中心
  cloud:
    consul:
      #consul服務(wù)地址
      host: localhost
      #consul端口號(hào)
      port: 8500
      discovery:
        #配置注冊(cè)中心顯示當(dāng)前服務(wù)的ip
        prefer-ip-address: true
        #配置當(dāng)前服務(wù)的ip和端口號(hào)
        #instance-id: ${spring.cloud.client.ipAddress}:${server.port}
        #配置該項(xiàng)點(diǎn)擊ip會(huì)跳轉(zhuǎn)至對(duì)應(yīng)的接口swagger頁(yè)面
        health-check-url: http://${spring.cloud.client.ipAddress}:${server.port}/swagger-ui.html  # ${server.port}為該服務(wù)的端口號(hào)

---
#開(kāi)發(fā)環(huán)境配置
server:
  #端口
  port: 8081
spring:
  profiles: dev
#日志
logging:
  config: classpath:log/logback.xml
  path: log/consul-consumer

---
#測(cè)試環(huán)境配置
server:
  #端口
  port: 8082
spring:
  profiles: test
#日志
logging:
  config: classpath:log/logback.xml
  path: /home/log/consul-consumer

---
#生產(chǎn)環(huán)境配置
server:
  #端口
  port: 8083
spring:
  profiles: prod
#日志
logging:
  config: classpath:log/logback.xml
  path: /home/log/consul-consumer

其次:config目錄下增加SwaggerConfig類(lèi)加入以下代碼:

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket userApi() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.zhangbox.eureka.consumer.controller"))//過(guò)濾的接口,有這掃描才會(huì)看到接口信息
                .paths(PathSelectors.any())
                .build();
        return docket;
    }


    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("eureka服務(wù)端消費(fèi)者接口平臺(tái)").description("服務(wù)相關(guān)數(shù)據(jù)接口")
                .termsOfServiceUrl("http://www.zhang.box.cn/").contact("技術(shù)開(kāi)發(fā)部")
                .license("Licence Version 1.0").licenseUrl("#").version("1.0").build();
    }

}

接著:service包下創(chuàng)建StudentConsumerService類(lèi)并加入以下代碼:

@FeignClient(value = "consul-provider")
public interface StudentConsumerService {

    /**
     * 查詢(xún)所有的學(xué)生信息
     *
     * @param sname
     * @param age
     * @return
     */
    @RequestMapping(value = "/student/list",method = RequestMethod.GET)
    String getStudentList(@RequestParam(value = "sname") String sname, @RequestParam(value = "age") Integer age);
}

然后:controller包下創(chuàng)建StudentConteroller并加入如下代碼:

@Controller
@RequestMapping("/student")
@Api(value = "eureka-consumer", description = "學(xué)生查詢(xún)接口")
public class StudentConteroller {
    private static final Logger LOGGER = LoggerFactory.getLogger(StudentConteroller.class);

    @Autowired
    StudentConsumerService studentService;

    /**
     * 查詢(xún)所有的學(xué)生信息
     *
     * @param sname
     * @param age
     * @param modelMap
     * @return
     */
    @ResponseBody
    @GetMapping("/consumer/list")
    public String list(
            @ApiParam(value = "學(xué)生姓名") @RequestParam(required = false) String sname,
            @ApiParam(value = "年齡") @RequestParam(required = false) Integer age,
            ModelMap modelMap) {
        String json = null;
        try {
            json = studentService.getStudentList(sname, age);
        } catch (Exception e) {
            e.printStackTrace();
            modelMap.put("ren_code", "0");
            modelMap.put("ren_msg", "查詢(xún)失敗===>" + e);
            LOGGER.error("查詢(xún)失敗===>" + e);
            json = JSON.toJSONString(modelMap);
        }
        return json;
    }
}

接著:創(chuàng)建核心啟動(dòng)類(lèi):

@EnableFeignClients//開(kāi)啟Feign調(diào)用接口
@EnableDiscoveryClient//開(kāi)啟客戶(hù)端服務(wù),沒(méi)有這個(gè)注解會(huì)報(bào)Feign找不到對(duì)應(yīng)服務(wù)的錯(cuò)誤
@SpringBootApplication
public class ConsulConsumerApplication extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(EurekaConsumerApplication.class, args);
    }
}

至此consul-consumer服務(wù)提供者創(chuàng)建完成,瀏覽器輸入地址:http://127.0.0.1:8081/swagger-ui.html
consul注冊(cè)中心可以看到服務(wù)提供和消費(fèi)者都在:

跳轉(zhuǎn)看到swagger的頁(yè)面并可是測(cè)試服務(wù)消費(fèi)者的接口,可以看到如下頁(yè)面,并點(diǎn)擊try it out按鈕,返回了正確的學(xué)生信息數(shù)據(jù)

返回?cái)?shù)據(jù)如下:

{
    "ren_code": "0",
    "ren_msg": "查詢(xún)成功",
    "studentList": [{
        "age": "17",
        "birth": "2010-07-22",
        "dept": "王同學(xué)學(xué)習(xí)成績(jī)很不錯(cuò)",
        "sex": "1",
        "sname": "王同學(xué)",
        "sno": 1
    }, {
        "age": "17",
        "birth": "2010-07-22",
        "dept": "李同學(xué)學(xué)習(xí)成績(jī)很不錯(cuò)",
        "sex": "1",
        "sname": "李同學(xué)",
        "sno": 2
    }]
}

以上就是spring cloud基于consul實(shí)現(xiàn)分布式服務(wù)注冊(cè)與消費(fèi)的整合流程,是不是很簡(jiǎn)單,你也來(lái)小試牛刀一把吧。

源碼地址

SpringCloud核心教程 | 第四篇:服務(wù)注冊(cè)與發(fā)現(xiàn) Consul篇

寫(xiě)在最后

歡迎關(guān)注、喜歡、和點(diǎn)贊后續(xù)將推出更多的spring cloud教程,敬請(qǐng)期待。
歡迎關(guān)注我的微信公眾號(hào)獲取更多更全的學(xué)習(xí)資源,視頻資料,技術(shù)干貨!

文章版權(quán)歸作者所有,未經(jīng)允許請(qǐng)勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請(qǐng)注明本文地址:http://m.hztianpu.com/yun/76721.html

相關(guān)文章

  • 2021 年最新基于 Spring Cloud 的微服務(wù)架構(gòu)分析

    摘要:是一個(gè)相對(duì)比較新的微服務(wù)框架,年才推出的版本雖然時(shí)間最短但是相比等框架提供的全套的分布式系統(tǒng)解決方案。提供線程池不同的服務(wù)走不同的線程池,實(shí)現(xiàn)了不同服務(wù)調(diào)用的隔離,避免了服務(wù)器雪崩的問(wèn)題。通過(guò)互相注冊(cè)的方式來(lái)進(jìn)行消息同步和保證高可用。 Spring Cloud 是一個(gè)相對(duì)比較新的微服務(wù)框架,...

    cikenerd 評(píng)論0 收藏0
  • 史上最簡(jiǎn)單的SpringCloud教程 | :斷路器(Hystrix)

    摘要:為了保證其高可用,單個(gè)服務(wù)又必須集群部署。為了解決這個(gè)問(wèn)題,就出現(xiàn)斷路器模型。一斷路器簡(jiǎn)介摘自官網(wǎng)已經(jīng)創(chuàng)建了一個(gè)名為的庫(kù)來(lái)實(shí)現(xiàn)斷路器模式。較底層的服務(wù)如果出現(xiàn)故障,會(huì)導(dǎo)致連鎖故障。當(dāng)對(duì)特定的服務(wù)的調(diào)用達(dá)到一個(gè)閥值是秒次斷路器將會(huì)被打開(kāi)。 轉(zhuǎn)載請(qǐng)標(biāo)明出處: http://blog.csdn.net/forezp/a...本文出自方志朋的博客 在微服務(wù)架構(gòu)中,我們將業(yè)務(wù)拆分成一個(gè)個(gè)的服務(wù),...

    Hydrogen 評(píng)論0 收藏0
  • Spring Cloud Alibaba到底坑不坑?

    摘要:我沒(méi)有能力去控制那些自媒體發(fā)布這些不實(shí)的內(nèi)容,但是在我了解的范圍內(nèi),還是盡力輸出一些我的理解。 之前我發(fā)過(guò)一篇《說(shuō)說(shuō)我為什么看好Spring Cloud Alibaba》,然后這兩天有網(wǎng)友給我轉(zhuǎn)了這篇文章《坑爹項(xiàng)目spring-cloud-alibaba,我們也來(lái)一個(gè)》,問(wèn)我的看法是怎么樣的,聊天時(shí)候簡(jiǎn)單說(shuō)了一下。今天在家休息,抽空整理一下內(nèi)容,逐點(diǎn)說(shuō)一下我的看法,主要還是覺(jué)得這篇文章...

    娣辯孩 評(píng)論0 收藏0

發(fā)表評(píng)論

0條評(píng)論

閱讀需要支付1元查看
<