主頁 > 軟體設計 > 服務注冊中心:Eureka

服務注冊中心:Eureka

2021-01-31 10:45:23 軟體設計

目錄

  • 第一章 注冊中心介紹
    • 1.1、什么是注冊中心
    • 1.2、為啥用注冊中心
    • 1.3、常見的注冊中心
  • 第二章 Eureka介紹
    • 2.1、Eureka的介紹
    • 2.2、Eureka的三種角色
    • 2.3、Eureka的運行流程
  • 第三章 Eureka入門案例
    • 3.1、創建注冊中心
    • 3.2、創建服務提供者
    • 3.3、創建服務消費者
  • 第四章 Eureka集群配置
    • 4.1、配置集群環境
    • 4.2、修改服務提供者
    • 4.3、修改服務消費者
  • 第五章 Eureka架構原理
  • 第六章 Eureka自我保護
    • 6.1、什么是自我保護
    • 6.2、為啥用自我保護
    • 6.3、如何關自我保護
  • 第七章 Eureka優雅停服
    • 7.1、什么是優雅停服
    • 7.2、如何配優雅停服
  • 第八章 Eureka安全認證
    • 8.1、什么是安全認證
    • 8.2、如何配安全認證
  • 第九章 Eureka配置詳解
    • 9.1、server
      • 9.1.1、server與client之間關聯配置
      • 9.1.2、server與remote之間關聯配置
      • 9.1.3、server與other之間關聯配置
      • 9.1.4、node與node之間關聯配置
    • 9.2、client
    • 9.3、instance
    • 9.4、dashboard


配套資料,免費下載
鏈接:https://pan.baidu.com/s/1la_3-HW-UvliDRJzfBcP_w
提取碼:lxfx
復制這段內容后打開百度網盤手機App,操作更方便哦

第一章 注冊中心介紹

1.1、什么是注冊中心

注冊中心可以說是微服務架構中的“通訊錄”,它記錄了服務和服務地址的映射關系,在分布式系統中,服務會注冊到這里,當服務需要呼叫其它服務時,就到這里找到服務的地址,進行呼叫,簡單的來說:服務注冊中心的作用就是服務的注冊服務的發現

1.2、為啥用注冊中心

了解了什么是注冊中心,那么我們繼續談談,為什么需要注冊中心,在分布式系統中,我們不僅僅是需要在注冊中心找到服務和服務地址的映射關系這么簡單,我們還需要考慮更多更復雜的問題:

  • 服務注冊后,如何及時發現
  • 服務宕機后,如何及時下線
  • 服務發現時,如何進行路由
  • 服務例外時,如何進行降級
  • 服務如何有效的水平擴展

這些問題的解決都依賴于注冊中心,簡單來看,注 冊中心的功能有點類似于 DNS 服務器或者負載均衡器,而實際上,注冊中心作為微服務的基礎組件,可能要更加復雜,也需要更多的靈活性和時效性,所以,我們還需要學習更多 Spring Cloud 微服務組件協同完成應用開發,

1.3、常見的注冊中心

特性Eureka(會用)Nacos(重點)Consul(了解)Zookeeper(了解)
CAPAPCP + APCPCP
健康檢查Client BeatTCP/HTTP/MYSQL/Client BeatTCP/HTTP/gRPC/CmdKeep Alive
雪崩保護
自動注銷實體支持支持不支持支持
訪問協議HTTPHTTP/DNSHTTP/DNSTCP
監聽支持支持支持支持支持
多資料中心支持支持支持不支持
跨注冊中心同步不支持支持支持不支持
SpringCloud集成支持支持支持支持

第二章 Eureka介紹

2.1、Eureka的介紹

Eureka 是 Netflix 開發的服務發現組件,本身是一個基于 REST 的服務,Spring Cloud 將它集成在其子專案 Spring Cloud Netflix 中,實作 Spring Cloud 的服務注冊與發現,同時還提供了負載均衡、故障轉移等能力,

2.2、Eureka的三種角色

  • Eureka Server:通過 Register、Get、Renew 等介面提供服務的注冊和發現,
  • Service Provider:服務提供方,把自身的服務實體注冊到 Eureka Server 中,
  • Service Consumer:服務呼叫方,通過 Eureka Server 獲取服務串列,消費服務,

2.3、Eureka的運行流程

第三章 Eureka入門案例

3.1、創建注冊中心

(1)在spring-cloud-study下創建一個子模塊,名稱叫:eureka-server7001

(2)在eureka-server7001的pom.xml中,添加以下依賴資訊

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </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.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.16</version>
    </dependency>    
</dependencies>

(3)創建一個組態檔,名字叫application.yaml,然后把以下這段配置拷貝進去

server:
  port: 7001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: eureka-server

eureka:
  instance:
    #服務注冊中心實體的主機名
    hostname: localhost
  client:
    #是否將自己注冊到注冊中心,默認為 true,單實體模式下需要設定為 false
    register-with-eureka: false
    #是否從注冊中心獲取服務注冊資訊,默認為 true,單實體模式下需要設定為 false
    fetch-registry: false
    #注冊中心對外暴露的注冊地址
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

(4)創建一個包名字叫com.caochenlei,在這個包下創建一個主啟動類EurekaServer7001Application

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

(5)啟動當前注冊中心應用服務,然后打開瀏覽器,在瀏覽器地址欄中輸入:http://localhost:7001/

3.2、創建服務提供者

(1)在spring-cloud-study下創建一個子模塊,名稱叫:service-provider8001

(2)在service-provider8001的pom.xml中,添加以下依賴資訊

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </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.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.16</version>
    </dependency>
</dependencies>

(3)創建一個組態檔,名字叫application.yaml,然后把以下這段配置拷貝進去

server:
  port: 8001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: service-provider

eureka:
  instance:
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://localhost:7001/eureka/

(4)創建一個包名字叫com.caochenlei,在這個包下創建一個主啟動類ServiceProvider8001Application

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

(5)撰寫物體類代碼(com.caochenlei.pojo.Product)

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Product implements Serializable {
    private Integer pid;
    private String name;
    private Double price;
    private Integer count;
}

(6)撰寫服務層介面(com.caochenlei.service.ProductService)

public interface ProductService {
    /**
     * 查找所有商品
     * @return
     */
    public List<Product> findAll();
}

(7)撰寫服務層實作(com.caochenlei.service.impl.ProductServiceImpl)

@Service
public class ProductServiceImpl implements ProductService {
    @Override
    public List<Product> findAll() {
        return Arrays.asList(
                new Product(1, "小米手機", 1000.0D, 100),
                new Product(2, "華為手機", 2000.0D, 200),
                new Product(3, "蘋果手機", 3000.0D, 300)
        );
    }
}

(8)撰寫控制層代碼(com.caochenlei.controller.ProductController)

@RestController
public class ProductController {
    @Autowired
    private ProductService productService;

    @RequestMapping("/provider/product/findAll")
    public List<Product> findAll() {
        return productService.findAll();
    }
}

(9)啟動當前服務提供者,然后打開瀏覽器,在瀏覽器地址欄中輸入:http://localhost:7001/

image-20210129215639316

(10)測驗我們剛才寫的業務代碼,在瀏覽器地址欄中輸入:http://localhost:8001/provider/product/findAll

3.3、創建服務消費者

(1)在spring-cloud-study下創建一個子模塊,名稱叫:service-consumer9001

(2)在service-consumer9001的pom.xml中,添加以下依賴資訊

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </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.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.16</version>
    </dependency>
</dependencies>

(3)創建一個組態檔,名字叫application.yaml,然后把以下這段配置拷貝進去

server:
  port: 9001

spring:
  application:
    name: service-consumer9001

eureka:
  client:
    #是否將自己注冊到注冊中心,默認為 true
    register-with-eureka: false
    #表示 Eureka Client 間隔多久去服務器拉取注冊資訊,默認為 30 秒
    registry-fetch-interval-seconds: 10
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://localhost:7001/eureka/

(4)創建一個包名字叫com.caochenlei,在這個包下創建一個主啟動類ServiceConsumer9001Application

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

    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}

(5)撰寫物體類代碼(com.caochenlei.pojo.Product)

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Product implements Serializable {
    private Integer pid;
    private String name;
    private Double price;
    private Integer count;
}

(6)撰寫控制層代碼(com.caochenlei.controller.ProductController)

@RestController
public class ProductController {
    public static final String BASE_URL = "http://localhost:8001";

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/consumer/product/findAll")
    public List<Product> findAll() {
        String findAllUrl = BASE_URL + "/provider/product/findAll";
        Product[] products = restTemplate.getForObject(findAllUrl, Product[].class);
        return Arrays.asList(products);
    }
}

(7)啟動當前服務消費者,然后打開瀏覽器,在瀏覽器地址欄中輸入:http://localhost:9001/consumer/product/findAll

注意:我們現在雖然可以正常呼叫成功,但聰明的你一定要知道,我們現在只是學習了注冊中心的搭建和服務的注冊,并沒有學習服務的遠程呼叫,這個restTemplate本身就是spring提供的一種訪問restful風格的模板類,他不是spring cloud的知識點,spring cloud下服務的呼叫我們會在后續章節或技術中進行介紹,這里特別說明,是怕大家混淆,我們這一章節重點學習注冊中心,

第四章 Eureka集群配置

4.1、配置集群環境

(1)在剛才的父工程下再創建一個 eureka-server7002 注冊中心的專案,如果是多機器部署不用修改埠,通過 IP 區分服務,如果在一臺機器上演示需要修改埠區分服務,

(2)添加域名映射,eureka會把hostname相同的url移除掉,如果我們配置的都是localhost,所以雖然你啟動了兩個eureka,但是它們不會把自己當成集群

C:\Windows\System32\drivers\etc\hosts

127.0.0.1 eureka-server7001.com
127.0.0.1 eureka-server7002.com

(3)修改eureka-server7001application.yaml

server:
  port: 7001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: eureka-server

eureka:
  instance:
    #服務注冊中心實體的主機名
    hostname: eureka-server7001.com
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址,指向另一個注冊中心(除自己之外所有,多個使用逗號隔開)
    service-url:
      defaultZone: http://localhost:7002/eureka/

(4)修改eureka-server7002application.yaml

server:
  port: 7002

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: eureka-server

eureka:
  instance:
    #服務注冊中心實體的主機名
    hostname: eureka-server7002.com
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址,指向另一個注冊中心(除自己之外所有,多個使用逗號隔開)
    service-url:
      defaultZone: http://localhost:7001/eureka/

(5)啟動兩個注冊中心,他們會自動構成一個集群環境,我們先啟動7001的,然后再啟動7002的,先啟動哪一個無所謂,但是會報錯,這屬于正常現象,因為你另一臺還沒有啟動,沒有辦法注冊,等兩臺都啟動了,過一會清除一下控制臺,就發現不報錯了,

4.2、修改服務提供者

application.yaml

server:
  port: 8001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: service-provider

eureka:
  instance:
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://eureka-server7001.com:7001/eureka/,http://eureka-server7002.com:7002/eureka/

http://localhost:7001/ , http://localhost:7002/

4.3、修改服務消費者

application.yaml

server:
  port: 9001

spring:
  application:
    name: service-consumer9001

eureka:
  client:
    #是否將自己注冊到注冊中心,默認為 true
    register-with-eureka: false
    #表示 Eureka Client 間隔多久去服務器拉取注冊資訊,默認為 30 秒
    registry-fetch-interval-seconds: 10
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://eureka-server7001.com:7001/eureka/,http://eureka-server7002.com:7002/eureka/

ProductController

@RestController
public class ProductController {
    @Autowired
    private RestTemplate restTemplate;

    @Autowired
    private DiscoveryClient discoveryClient;

    @RequestMapping("/consumer/product/findAll")
    public List<Product> findAll() {
        //獲取注冊中心服務串列
        List<ServiceInstance> instances = discoveryClient.getInstances("SERVICE-PROVIDER");
        if (CollectionUtils.isEmpty(instances)) {
            return null;
        }

        //回圈遍歷列印服務物體
        for (ServiceInstance instance : instances) {
            System.out.println(instance.getUri());
            System.out.println(instance.getHost());
            System.out.println(instance.getPort());
            System.out.println("====================");
        }

        //我們拿出第一個服務物體
        ServiceInstance si = instances.get(0);
        String findAllUrl = si.getUri() + "/provider/product/findAll";
        Product[] products = restTemplate.getForObject(findAllUrl, Product[].class);
        return Arrays.asList(products);
    }
}

http://localhost:9001/consumer/product/findAll

注意:這里我們使用了discoveryClient獲取了注冊中心SERVICE-PROVIDER服務的服務串列,就是discoveryClient用來發現服務中心對應服務的地址,然后使用restTemplate進行遠程呼叫,上一章節的服務地址是咱們自己寫死的,這里就更進一步,往后還有更好用的呼叫方式,

第五章 Eureka架構原理

  • Register(服務注冊):把自己的 IP 和埠注冊給 Eureka,
  • Renew(服務續約):發送心跳包,每 30 秒發送一次,告訴 Eureka 自己還活著,如果 90 秒還未發送心跳,宕機,
  • Cancel(服務下線):當 Provider 關閉時會向 Eureka 發送訊息,把自己從服務串列中洗掉,防止 Consumer 呼叫到不存在的服務,
  • Get Registry(獲取服務注冊串列):獲取其他服務串列,
  • Replicate(集群中資料同步):Eureka 集群中的資料復制與同步,
  • Make Remote Call(遠程呼叫):完成服務的遠程呼叫,

第六章 Eureka自我保護

6.1、什么是自我保護

一般情況下,服務在 Eureka 上注冊后,會每 30 秒發送心跳包,Eureka 通過心跳來判斷服務是否健康,同時會定期洗掉超過 90 秒沒有發送心跳的服務,Eureka Server 在運行期間會去統計心跳失敗比例在 15 分鐘之內是否低于 85%,如果低于 85%,Eureka Server 會將這些實體保護起來,讓這些實體不會過期,同時提示一個警告,這種演算法叫做 Eureka Server 的自我保護模式,這種自我保護模式默認開啟,

有兩種情況會導致 Eureka Server 收不到微服務的心跳:

  • 微服務自身的原因
  • 微服務與 Eureka 之間的網路故障

6.2、為啥用自我保護

  • 因為同時保留"好資料"與"壞資料"總比丟掉任何資料要更好,當網路故障恢復后,這個 Eureka 節點會退出"自我保護模式",
  • Eureka 還有客戶端快取功能(也就是微服務的快取功能),即使 Eureka 集群中所有節點都宕機失效,微服務的 Provider 和 Consumer 都能正常通信,
  • 微服務的負載均衡策略會自動剔除死亡的微服務節點,

6.3、如何關自我保護

注冊中心配置自我保護:

eureka:
  server:
    #true:開啟自我保護模式,false:關閉自我保護模式
    enable-self-preservation: false
    #清理間隔(單位:毫秒,默認是 60*1000)
    eviction-interval-timer-in-ms: 60000

第七章 Eureka優雅停服

7.1、什么是優雅停服

在上一章節中,我們知道注冊中心注冊的服務默認會有自我保護模式,我們想要關閉這個模式也很簡單,要是我不想關閉這個模式,讓他正常默認啟用,現在我想要下線某一個服務,讓注冊中心知道,這個服務是我們人為的下線的,這時候,注冊中心應該正常踢出這個下線服務,而不是保護起來,這樣就不會觸發自我保護模式了,而其他的服務因為沒有停止仍然有可能會觸發自我保護模式,這個就是一種優雅的停止服務的方式,

7.2、如何配優雅停服

服務提供者配置優雅停服:

#度量指標監控與健康檢查
management:
  endpoints:
    web:
      exposure:
        #開啟 shutdown 端點訪問
        include: shutdown
  endpoint:
    #開啟 shutdown 實作優雅停服
    shutdown:
      enabled: true

打開postman使用post方式關閉服務:http://localhost:8001/actuator/shutdown

image-20210130113259668

第八章 Eureka安全認證

8.1、什么是安全認證

現在我們已經學會搭建Eureka注冊中心集群,但是,這個訪問地址我們是可以直接訪問的,既然我們可以直接訪問,那要是部署到線上,別人是不是也可以通過地址直接來訪問咱們的注冊中心,這會存在安全隱患,我們能不能在訪問注冊中心的時候,需要賬號和密碼的驗證,以此來保證訪問當前注冊中心的一定是咱們可信的人,那這個就是注冊中心的安全認證,

8.2、如何配安全認證

(1)注冊中心添加 security 依賴,兩個都要加

<!-- spring boot security 依賴 -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

(2)注冊中心配置 security 認證,兩個都要配

eureka-server7001的application.yaml

server:
  port: 7001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: eureka-server
  # 安全認證
  security:
    user:
      name: root
      password: 123456

eureka:
  instance:
    #服務注冊中心實體的主機名
    hostname: eureka-server7001.com
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址,指向另一個注冊中心(除自己之外所有,多個使用逗號隔開)
    service-url:
      defaultZone: http://root:123456@eureka-server7002.com:7002/eureka/

eureka-server7002的application.yaml

server:
  port: 7002

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: eureka-server
  # 安全認證
  security:
    user:
      name: root
      password: 123456

eureka:
  instance:
    #服務注冊中心實體的主機名
    hostname: eureka-server7002.com
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址,指向另一個注冊中心(除自己之外所有,多個使用逗號隔開)
    service-url:
      defaultZone: http://root:123456@eureka-server7001.com:7001/eureka/

(3)修改服務提供者的注冊中心地址

server:
  port: 8001

spring:
  application:
    #該名稱在集群模式下應該保持一致
    name: service-provider

#度量指標監控與健康檢查
management:
  endpoints:
    web:
      exposure:
        #開啟 shutdown 端點訪問
        include: shutdown
  endpoint:
    #開啟 shutdown 實作優雅停服
    shutdown:
      enabled: true

eureka:
  instance:
    #是否使用 ip 地址注冊
    prefer-ip-address: true
    #該實體注冊到服務中心的唯一ID
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
  client:
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://root:123456@eureka-server7001.com:7001/eureka/,http://root:123456@eureka-server7002.com:7002/eureka/

(4)修改服務消費者的注冊中心地址

server:
  port: 9001

spring:
  application:
    name: service-consumer9001

eureka:
  client:
    #是否將自己注冊到注冊中心,默認為 true
    register-with-eureka: false
    #表示 Eureka Client 間隔多久去服務器拉取注冊資訊,默認為 30 秒
    registry-fetch-interval-seconds: 10
    #設定服務注冊中心地址
    service-url:
      defaultZone: http://root:123456@eureka-server7001.com:7001/eureka/,http://root:123456@eureka-server7002.com:7002/eureka/

(5)配置注冊中心的csrf

Eureka 會自動化配置 CSRF 防御機制,Spring Security 認為 POST, PUT, and DELETE http methods 都是有風險的,如果這些 method 發送程序中沒有帶上 CSRF token 的話,會被直接攔截并回傳 403 forbidden,我們應該使 CSRF 忽略 /eureka/** 的所有請求,

在每一個注冊中心的com.caochenlei包下創建一個配置類,名字叫WebSecurityConfig

@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http); // 加這句是為了訪問 eureka 控制臺和 /actuator 時能做安全控制
        http.csrf().ignoringAntMatchers("/eureka/**"); // 忽略 /eureka/** 的所有請求
    }
}

(6)重新啟動所有的專案,啟動的順序以此是

  1. eureka-server7001
  2. eureka-server7002
  3. service-provider8001
  4. service-consumer9001

(7)打開瀏覽器輸入Eureka的控制臺地址,分別訪問

http://localhost:7001/

http://localhost:7002/

image-20210130123236854

第九章 Eureka配置詳解

9.1、server

9.1.1、server與client之間關聯配置

#服務端開啟自我保護模式,無論什么情況,服務端都會保持一定數量的服務,避免client與server的網路問題,而出現大量的服務被清除,
eureka.server.enable-self-preservation=true
#開啟清除無效服務的定時任務,時間間隔,默認1分鐘
eureka.server.eviction-interval-timer-in-ms= 60000
#間隔多長時間,清除過期的delta資料
eureka.server.delta-retention-timer-interval-in-ms=0
#過期資料,是否也提供給client
eureka.server.disable-delta=false
#eureka服務端是否記錄client的身份header
eureka.server.log-identity-headers=true
#請求頻率限制器
eureka.server.rate-limiter-burst-size=10
#是否開啟請求頻率限制器
eureka.server.rate-limiter-enabled=false
#請求頻率的平均值
eureka.server.rate-limiter-full-fetch-average-rate=100
#是否對標準的client進行頻率請求限制,如果是false,則只對非標準client進行限制
eureka.server.rate-limiter-throttle-standard-clients=false
#注冊服務、拉去服務串列資料的請求頻率的平均值
eureka.server.rate-limiter-registry-fetch-average-rate=500
#設定信任的client list
eureka.server.rate-limiter-privileged-clients=
#在設定的時間范圍類,期望與client續約的百分比,
eureka.server.renewal-percent-threshold=0.85
#多長時間更新續約的閾值
eureka.server.renewal-threshold-update-interval-ms=0
#對于快取的注冊資料,多長時間過期
eureka.server.response-cache-auto-expiration-in-seconds=180
#多長時間更新一次快取中的服務注冊資料
eureka.server.response-cache-update-interval-ms=0
#快取增量資料的時間,以便在檢索的時候不丟失資訊
eureka.server.retention-time-in-m-s-in-delta-queue=0
#當時間戳不一致的時候,是否進行同步
eureka.server.sync-when-timestamp-differs=true
#是否采用只讀快取策略,只讀策略對于快取的資料不會過期,
eureka.server.use-read-only-response-cache=true

9.1.2、server與remote之間關聯配置

#過期資料,是否也提供給遠程region
eureka.server.disable-delta-for-remote-regions=false
#回退到遠程區域中的應用程式的舊行為 (如果已配置) 如果本地區域中沒有該應用程式的實體, 則將被禁用,
eureka.server.disable-transparent-fallback-to-other-region=false
#指示在服務器支持的情況下, 是否必須為遠程區域壓縮從尤里卡服務器獲取的內容,
eureka.server.g-zip-content-from-remote-region=true
#連接eureka remote note的連接超時時間
eureka.server.remote-region-connect-timeout-ms=1000
#remote region 應用白名單
eureka.server.remote-region-app-whitelist.
#連接eureka remote note的連接空閑時間
eureka.server.remote-region-connection-idle-timeout-seconds=30
#執行remote region 獲取注冊資訊的請求執行緒池大小
eureka.server.remote-region-fetch-thread-pool-size=20
#remote region 從對等eureka加點讀取資料的超時時間
eureka.server.remote-region-read-timeout-ms=1000
#從remote region 獲取注冊資訊的時間間隔
eureka.server.remote-region-registry-fetch-interval=30
#remote region 連接eureka節點的總連接數量
eureka.server.remote-region-total-connections=1000
#remote region 連接eureka節點的單機連接數量
eureka.server.remote-region-total-connections-per-host=50
#remote region抓取注冊資訊的存盤檔案,而這個可靠的存盤檔案需要全限定名來指定
eureka.server.remote-region-trust-store=
#remote region 儲存的檔案的密碼
eureka.server.remote-region-trust-store-password=
#remote region url.多個逗號隔開
eureka.server.remote-region-urls=
#remote region url.多個逗號隔開
eureka.server.remote-region-urls-with-name=

9.1.3、server與other之間關聯配置

#快取ASG資訊的過期時間,
eureka.server.a-s-g-cache-expiry-timeout-ms=0
#查詢ASG資訊的超時時間
eureka.server.a-s-g-query-timeout-ms=300
#服務更新ASG資訊的頻率
eureka.server.a-s-g-update-interval-ms=0
#AWS訪問ID
eureka.server.a-w-s-access-id=
#AWS安全密鑰
eureka.server.a-w-s-secret-key=
#AWS系結策略
eureka.server.binding-strategy=eip
#用于從第三方AWS 帳戶描述自動擴展分組的角色的名稱,
eureka.server.list-auto-scaling-groups-role-name=
#是否應該建立連接引導
eureka.server.prime-aws-replica-connections=true
#服務端嘗試系結候選EIP的次數
eureka.server.e-i-p-bind-rebind-retries=3
#服務端系結EIP的時間間隔.如果系結就檢查;如果系結失效就重新系結,當且僅當已經系結的情況
eureka.server.e-i-p-binding-retry-interval-ms=10
#服務端系結EIP的時間間隔.當且僅當服務為系結的情況
eureka.server.e-i-p-binding-retry-interval-ms-when-unbound=
#服務端嘗試系結route53的次數
eureka.server.route53-bind-rebind-retries=3
#服務端間隔多長時間嘗試系結route53
eureka.server.route53-binding-retry-interval-ms=30
#用于建立route53域的ttl,默認為30
eureka.server.route53-domain-t-t-l=10

9.1.4、node與node之間關聯配置

#發送復制資料是否在request中,總是壓縮
eureka.server.enable-replicated-request-compression=false
#指示群集節點之間的復制是否應批處理以提高網路效率,
eureka.server.batch-replication=false
#允許備份到備份池的最大復制事件數量,而這個備份池負責除狀態更新的其他事件,可以根據記憶體大小,超時和復制流量,來設定此值得大小
eureka.server.max-elements-in-peer-replication-pool=10000
#允許備份到狀態備份池的最大復制事件數量
eureka.server.max-elements-in-status-replication-pool=10000
#多個服務中心相互同步資訊執行緒的最大空閑時間
eureka.server.max-idle-thread-age-in-minutes-for-peer-replication=15
#狀態同步執行緒的最大空閑時間
eureka.server.max-idle-thread-in-minutes-age-for-status-replication=15
#服務注冊中心各個instance相互復制資料的最大執行緒數量
eureka.server.max-threads-for-peer-replication=20
#服務注冊中心各個instance相互復制狀態資料的最大執行緒數量
eureka.server.max-threads-for-status-replication=1
#instance之間復制資料的通信時長
eureka.server.max-time-for-replication=30000
#正常的對等服務instance最小數量,-1表示服務中心為單節點,
eureka.server.min-available-instances-for-peer-replication=-1
#instance之間相互復制開啟的最小執行緒數量
eureka.server.min-threads-for-peer-replication=5
#instance之間用于狀態復制,開啟的最小執行緒數量
eureka.server.min-threads-for-status-replication=1
#instance之間復制資料時可以重試的次數
eureka.server.number-of-replication-retries=5
#eureka節點間間隔多長時間更新一次資料,默認10分鐘,
eureka.server.peer-eureka-nodes-update-interval-ms=600000
#eureka服務狀態的相互更新的時間間隔,
eureka.server.peer-eureka-status-refresh-time-interval-ms=0
#eureka對等節點間連接超時時間
eureka.server.peer-node-connect-timeout-ms=200
#eureka對等節點連接后的空閑時間
eureka.server.peer-node-connection-idle-timeout-seconds=30
#節點間的讀資料連接超時時間
eureka.server.peer-node-read-timeout-ms=200
#eureka server 節點間連接的總共最大數量
eureka.server.peer-node-total-connections=1000
#eureka server 節點間連接的單機最大數量
eureka.server.peer-node-total-connections-per-host=10
#在服務節點啟動時,eureka嘗試獲取注冊資訊的次數
eureka.server.registry-sync-retries=
#在服務節點啟動時,eureka多次嘗試獲取注冊資訊的間隔時間
eureka.server.registry-sync-retry-wait-ms=
#當eureka server啟動的時候,不能從對等節點獲取instance注冊資訊的情況,應等待多長時間,
eureka.server.wait-time-in-ms-when-sync-empty=0

9.2、client

#該客戶端是否可用
eureka.client.enabled=true
#實體是否在eureka服務器上注冊自己的資訊以供其他服務發現,默認為true
eureka.client.register-with-eureka=false
#此客戶端是否獲取eureka服務器注冊表上的注冊資訊,默認為true
eureka.client.fetch-registry=false
#是否過濾掉,非UP的實體,默認為true
eureka.client.filter-only-up-instances=true
#與Eureka注冊服務中心的通信zone和url地址
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/
#client連接Eureka服務端后的空閑等待時間,默認為30 秒
eureka.client.eureka-connection-idle-timeout-seconds=30
#client連接eureka服務端的連接超時時間,默認為5秒
eureka.client.eureka-server-connect-timeout-seconds=5
#client對服務端的讀超時時長
eureka.client.eureka-server-read-timeout-seconds=8
#client連接all eureka服務端的總連接數,默認200
eureka.client.eureka-server-total-connections=200
#client連接eureka服務端的單機連接數量,默認50
eureka.client.eureka-server-total-connections-per-host=50
#執行程式指數回退重繪的相關屬性,是重試延遲的最大倍數值,默認為10
eureka.client.cache-refresh-executor-exponential-back-off-bound=10
#執行程式快取重繪執行緒池的大小,默認為5
eureka.client.cache-refresh-executor-thread-pool-size=2
#心跳執行程式回退相關的屬性,是重試延遲的最大倍數值,默認為10
eureka.client.heartbeat-executor-exponential-back-off-bound=10
#心跳執行程式執行緒池的大小,默認為5
eureka.client.heartbeat-executor-thread-pool-size=5
# 詢問Eureka服務url資訊變化的頻率(s),默認為300秒
eureka.client.eureka-service-url-poll-interval-seconds=300
#最初復制實體資訊到eureka服務器所需的時間(s),默認為40秒
eureka.client.initial-instance-info-replication-interval-seconds=40
#間隔多長時間再次復制實體資訊到eureka服務器,默認為30秒
eureka.client.instance-info-replication-interval-seconds=30
#從eureka服務器注冊表中獲取注冊資訊的時間間隔(s),默認為30秒
eureka.client.registry-fetch-interval-seconds=30
# 獲取實體所在的地區,默認為us-east-1
eureka.client.region=us-east-1
#實體是否使用同一zone里的eureka服務器,默認為true,理想狀態下,eureka客戶端與服務端是在同一zone下
eureka.client.prefer-same-zone-eureka=true
# 獲取實體所在的地區下可用性的區域串列,用逗號隔開,(AWS)
eureka.client.availability-zones.china=defaultZone,defaultZone1,defaultZone2
#eureka服務注冊表資訊里的以逗號隔開的地區名單,如果不這樣回傳這些地區名單,則客戶端啟動將會出錯,默認為null
eureka.client.fetch-remote-regions-registry=
#服務器是否能夠重定向客戶端請求到備份服務器, 如果設定為false,服務器將直接處理請求,如果設定為true,它可能發送HTTP重定向到客戶端,默認為false
eureka.client.allow-redirects=false
#客戶端資料接收
eureka.client.client-data-accept=
#增量資訊是否可以提供給客戶端看,默認為false
eureka.client.disable-delta=false
#eureka服務器序列化/反序列化的資訊中獲取“_”符號的的替換字串,默認為“__“
eureka.client.escape-char-replacement=__
#eureka服務器序列化/反序列化的資訊中獲取“$”符號的替換字串,默認為“_-”
eureka.client.dollar-replacement="_-"
#當服務端支持壓縮的情況下,是否支持從服務端獲取的資訊進行壓縮,默認為true
eureka.client.g-zip-content=true
#是否記錄eureka服務器和客戶端之間在注冊表的資訊方面的差異,默認為false
eureka.client.log-delta-diff=false
# 如果設定為true,客戶端的狀態更新將會點播更新到遠程服務器上,默認為true
eureka.client.on-demand-update-status-change=true
#此客戶端只對一個單一的VIP注冊表的資訊感興趣,默認為null
eureka.client.registry-refresh-single-vip-address=
#client是否在初始化階段強行注冊到服務中心,默認為false
eureka.client.should-enforce-registration-at-init=false
#client在shutdown的時候是否顯示的注銷服務從服務中心,默認為true
eureka.client.should-unregister-on-shutdown=true
# 獲取eureka服務的代理主機,默認為null
eureka.client.proxy-host=
#獲取eureka服務的代理密碼,默認為null
eureka.client.proxy-password=
# 獲取eureka服務的代理埠, 默認為null
eureka.client.proxy-port=
# 獲取eureka服務的代理用戶名,默認為null
eureka.client.proxy-user-name=
#屬性解釋器
eureka.client.property-resolver=
#獲取實作了eureka客戶端在第一次啟動時讀取注冊表的資訊作為回退選項的實作名稱
eureka.client.backup-registry-impl=
#這是一個短暫的×××的配置,如果最新的×××是穩定的,則可以去除,默認為null
eureka.client.decoder-name=
#這是一個短暫的編碼器的配置,如果最新的編碼器是穩定的,則可以去除,默認為null
eureka.client.encoder-name=
#是否使用DNS機制去獲取服務串列,然后進行通信,默認為false
eureka.client.use-dns-for-fetching-service-urls=false
#獲取要查詢的DNS名稱來獲得eureka服務器,此配置只有在eureka服務器ip地址串列是在DNS中才會用到,默認為null
eureka.client.eureka-server-d-n-s-name=
#獲取eureka服務器的埠,此配置只有在eureka服務器ip地址串列是在DNS中才會用到,默認為null
eureka.client.eureka-server-port=
#表示eureka注冊中心的路徑,如果配置為eureka,則為http://x.x.x.x:x/eureka/,在eureka的組態檔中加入此配置表示eureka作為客戶端向注冊中心注冊,從而構成eureka集群,此配置只有在eureka服務器ip地址串列是在DNS中才會用到,默認為null
eureka.client.eureka-server-u-r-l-context=

9.3、instance

#服務注冊中心實體的主機名
eureka.instance.hostname=localhost
#注冊在Eureka服務中的應用組名
eureka.instance.app-group-name=
#注冊在的Eureka服務中的應用名稱
eureka.instance.appname=
#該實體注冊到服務中心的唯一ID
eureka.instance.instance-id=
#該實體的IP地址
eureka.instance.ip-address=
#該實體,相較于hostname是否優先使用IP
eureka.instance.prefer-ip-address=false
#用于AWS平臺自動擴展的與此實體關聯的組名,
eureka.instance.a-s-g-name=
#部署此實體的資料中心
eureka.instance.data-center-info=
#默認的地址決議順序
eureka.instance.default-address-resolution-order=
#該實體的環境配置
eureka.instance.environment=
#初始化該實體,注冊到服務中心的初始狀態
eureka.instance.initial-status=up
#表明是否只要此實體注冊到服務中心,立馬就進行通信
eureka.instance.instance-enabled-onit=false
#該服務實體的命名空間,用于查找屬性
eureka.instance.namespace=eureka
#該服務實體的子定義元資料,可以被服務中心接受到
eureka.instance.metadata-map.test = test
#服務中心洗掉此服務實體的等待時間(秒為單位),時間間隔為最后一次服務中心接受到的心跳時間
eureka.instance.lease-expiration-duration-in-seconds=90
#該實體給服務中心發送心跳的間隔時間,用于表明該服務實體可用
eureka.instance.lease-renewal-interval-in-seconds=30
#該實體,注冊服務中心,默認打開的通信數量
eureka.instance.registry.default-open-for-traffic-count=1
#每分鐘續約次數
eureka.instance.registry.expected-number-of-renews-per-min=1
#該實體健康檢查url,絕對路徑
eureka.instance.health-check-url=
#該實體健康檢查url,相對路徑
eureka.instance.health-check-url-path=/health
#該實體的主頁url,絕對路徑
eureka.instance.home-page-url=
#該實體的主頁url,相對路徑
eureka.instance.home-page-url-path=/
#該實體的安全健康檢查url,絕對路徑
eureka.instance.secure-health-check-url=
#https通信埠
eureka.instance.secure-port=443
#https通信埠是否啟用
eureka.instance.secure-port-enabled=false
#http通信埠
eureka.instance.non-secure-port=80
#http通信埠是否啟用
eureka.instance.non-secure-port-enabled=true
#該實體的安全虛擬主機名稱(https)
eureka.instance.secure-virtual-host-name=unknown
#該實體的虛擬主機名稱(http)
eureka.instance.virtual-host-name=unknown
#該實體的狀態呈現url,絕對路徑
eureka.instance.status-page-url=
#該實體的狀態呈現url,相對路徑
eureka.instance.status-page-url-path=/status

9.4、dashboard

#是否啟用Eureka的儀表板,默認為true.
eureka.dashboard.enabled=true
#到Eureka儀表板的服務路徑(相對于servlet路徑),默認為“/”
eureka.dashboard.path=/

轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/254791.html

標籤:其他

上一篇:uniapp(vue通用)整合騰訊位置服務SDK---多平臺小程式通用

下一篇:Java線性表之無頭非回圈單向和雙向鏈表的實作

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 面試突擊第一季,第二季,第三季

    第一季必考 https://www.bilibili.com/video/BV1FE411y79Y?from=search&seid=15921726601957489746 第二季分布式 https://www.bilibili.com/video/BV13f4y127ee/?spm_id_fro ......

    uj5u.com 2020-09-10 05:35:24 more
  • 第三單元作業總結

    1.前言 這應該是本學期最后一次寫作業總結了吧。總體來說,對作業的節奏也差不多掌握了,作業做起來的效率也更高了。雖然和之前的作業一樣,作業中都要用到新的知識,但是相比之前,更加懂得了如何利用工具以及資料。雖然之間卡過殼,但總體而言,這幾次作業還算完成的比較好。 2.作業程序總結 相比前兩個單元,此單 ......

    uj5u.com 2020-09-10 05:35:41 more
  • 北航OO(2020)第四單元博客作業暨課程總結博客

    北航OO(2020)第四單元博客作業暨課程總結博客 本單元作業的架構設計 在本單元中,由于UML圖具有比較清晰的樹形結構,因此我對其中需要進行查詢操作的元素進行了包裝,在樹的父節點中存盤所有孩子的參考。考慮到性能問題,我采用了快取機制,一次查詢后盡可能快取已經遍歷過的資訊,以減少遍歷次數。 本單元我 ......

    uj5u.com 2020-09-10 05:35:48 more
  • BUAA_OO_第四單元

    一、UML決議器設計 ? 先看下題目:第四單元實作一個基于JDK 8帶有效性檢查的UML(Unified Modeling Language)類圖,順序圖,狀態圖分析器 MyUmlInteraction,實際上我們要建立一個有向圖模型,UML中的物件(元素)可能與同級元素連接,也可與低級元素相連形成 ......

    uj5u.com 2020-09-10 05:35:54 more
  • 6.1邏輯運算子

    邏輯運算子 1. && 短路與 運算式1 && 運算式2 01.運算式1為true并且運算式2也為true 整體回傳為true 02.運算式1為false,將不會執行運算式2 整體回傳為false 03.只要有一個運算式為false 整體回傳為false 2. || 短路或 運算式1 || 運算式2 ......

    uj5u.com 2020-09-10 05:35:56 more
  • BUAAOO 第四單元 & 課程總結

    1. 第四單元:StarUml檔案決議 本單元采用了圖模型決議UML。 UML檔案可以抽象為圖、子圖、邊的邏輯結構。 在實作中,圖的節點包括類、介面、屬性,子圖包括狀態圖、順序圖等。 采用了三次遍歷UML元素的方法建圖,第一遍遍歷建點,第二、三次遍歷設定屬性、連邊,實作圖物件的初始化。這里借鑒了一些 ......

    uj5u.com 2020-09-10 05:36:06 more
  • 談談我對C# 多型的理解

    面向物件三要素:封裝、繼承、多型。 封裝和繼承,這兩個比較好理解,但要理解多型的話,可就稍微有點難度了。今天,我們就來講講多型的理解。 我們應該經常會看到面試題目:請談談對多型的理解。 其實呢,多型非常簡單,就一句話:呼叫同一種方法產生了不同的結果。 具體實作方式有三種。 一、多載 多載很簡單。 p ......

    uj5u.com 2020-09-10 05:36:09 more
  • Python 資料驅動工具:DDT

    背景 python 的unittest 沒有自帶資料驅動功能。 所以如果使用unittest,同時又想使用資料驅動,那么就可以使用DDT來完成。 DDT是 “Data-Driven Tests”的縮寫。 資料:http://ddt.readthedocs.io/en/latest/ 使用方法 dd. ......

    uj5u.com 2020-09-10 05:36:13 more
  • Python里面的xlrd模塊詳解

    那我就一下面積個問題對xlrd模塊進行學習一下: 1.什么是xlrd模塊? 2.為什么使用xlrd模塊? 3.怎樣使用xlrd模塊? 1.什么是xlrd模塊? ?python操作excel主要用到xlrd和xlwt這兩個庫,即xlrd是讀excel,xlwt是寫excel的庫。 今天就先來說一下xl ......

    uj5u.com 2020-09-10 05:36:28 more
  • 當我們創建HashMap時,底層到底做了什么?

    jdk1.7中的底層實作程序(底層基于陣列+鏈表) 在我們new HashMap()時,底層創建了默認長度為16的一維陣列Entry[ ] table。當我們呼叫map.put(key1,value1)方法向HashMap里添加資料的時候: 首先,呼叫key1所在類的hashCode()計算key1 ......

    uj5u.com 2020-09-10 05:36:38 more
最新发布
  • 【中介者設計模式詳解】C/Java/JS/Go/Python/TS不同語言實作

    * 中介者模式是一種行為型設計模式,它可以用來減少類之間的直接依賴關系,
    * 將物件之間的通信封裝到一個中介者物件中,從而使得各個物件之間的關系更加松散。
    * 在中介者模式中,物件之間不再直接相互互動,而是通過中介者來中轉訊息。 ......

    uj5u.com 2023-04-20 08:20:47 more
  • 露天煤礦現場調研和交流案例分享

    他們集團的資訊化公司及研究院在一個礦區正在做智能礦山的統一平臺的 試點,專案投資大概1億,包括了礦山的各方面的內容,顯示得我們這次交流有點多余。他們2年前開始做智能礦山的規劃,有很多煤礦行業專家的加持,他們的描述是非常完美,但是去年底應該上線的平臺,現在還沒有看到影子。他們確實有很多場景需求,但是被... ......

    uj5u.com 2023-04-20 08:20:25 more
  • 《社區人員管理》實戰案例設計&個人案例分享

    設計是一個讓人夢想成真程序,開始編碼、測驗、除錯之前進行需求分析和架構設計,才能保證關鍵方面都做正確 ......

    uj5u.com 2023-04-20 08:20:17 more
  • 軟體架構生態化-多角色交付的探索實踐

    作為一個技術架構師,不僅僅要緊跟行業技術趨勢,還要結合研發團隊現狀及痛點,探索新的交付方案。在日常中,你是否遇到如下問題 “ 業務需求排期長研發是瓶頸;非研發角色感受不到研發技改提效的變化;引入ISV 團隊又擔心質量和安全,培訓周期長“等等,基于此我們探索了一種新的技術體系及交付方案來解決如上問題。 ......

    uj5u.com 2023-04-20 08:20:10 more
  • 【中介者設計模式詳解】C/Java/JS/Go/Python/TS不同語言實作

    * 中介者模式是一種行為型設計模式,它可以用來減少類之間的直接依賴關系,
    * 將物件之間的通信封裝到一個中介者物件中,從而使得各個物件之間的關系更加松散。
    * 在中介者模式中,物件之間不再直接相互互動,而是通過中介者來中轉訊息。 ......

    uj5u.com 2023-04-20 08:19:44 more
  • 露天煤礦現場調研和交流案例分享

    他們集團的資訊化公司及研究院在一個礦區正在做智能礦山的統一平臺的 試點,專案投資大概1億,包括了礦山的各方面的內容,顯示得我們這次交流有點多余。他們2年前開始做智能礦山的規劃,有很多煤礦行業專家的加持,他們的描述是非常完美,但是去年底應該上線的平臺,現在還沒有看到影子。他們確實有很多場景需求,但是被... ......

    uj5u.com 2023-04-20 08:19:07 more
  • 《社區人員管理》實戰案例設計&個人案例分享

    設計是一個讓人夢想成真程序,開始編碼、測驗、除錯之前進行需求分析和架構設計,才能保證關鍵方面都做正確 ......

    uj5u.com 2023-04-20 08:18:57 more
  • 軟體架構生態化-多角色交付的探索實踐

    作為一個技術架構師,不僅僅要緊跟行業技術趨勢,還要結合研發團隊現狀及痛點,探索新的交付方案。在日常中,你是否遇到如下問題 “ 業務需求排期長研發是瓶頸;非研發角色感受不到研發技改提效的變化;引入ISV 團隊又擔心質量和安全,培訓周期長“等等,基于此我們探索了一種新的技術體系及交付方案來解決如上問題。 ......

    uj5u.com 2023-04-20 08:18:49 more
  • 05單件模式

    #經典的單件模式 public class Singleton { private static Singleton uniqueInstance; //一個靜態變數持有Singleton類的唯一實體。 // 其他有用的實體變數寫在這里 //構造器宣告為私有,只有Singleton可以實體化這個類! ......

    uj5u.com 2023-04-19 08:42:51 more
  • 【架構與設計】常見微服務分層架構的區別和落地實踐

    軟體工程的方方面面都遵循一個最基本的道理:沒有銀彈,架構分層模型更是如此,每一種都有各自優缺點,所以請根據不同的業務場景,并遵循簡單、可演進這兩個重要的架構原則選擇合適的架構分層模型即可。 ......

    uj5u.com 2023-04-19 08:42:41 more