国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

這篇具有很好參考價值的文章主要介紹了Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

一、Eureka服務(wù)注冊與發(fā)現(xiàn)

1.1 概念

  • Eureka 是 Netflix 公司開源的一個服務(wù)注冊與發(fā)現(xiàn)的組件 。

  • Eureka 和其他 Netflix 公司的服務(wù)組件(例如負載均衡、熔斷器、網(wǎng)關(guān)等) 一起,被 Spring Cloud 社區(qū)整合為Spring-Cloud-Netflix 模塊。

  • Eureka 包含兩個組件:Eureka Server (注冊中心) 和 Eureka Client (服務(wù)提供者、服務(wù)消費者)

1.2 操作

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

1.3 搭建 Eureka Server 服務(wù)

(1)創(chuàng)建 eureka-server 模塊

(2) 引入 SpringCloud 和 euraka-server 相關(guān)依賴

(3)完成 Eureka Server 相關(guān)配置

(4)啟動該模塊

父工程 pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.liming</groupId>
    <artifactId>spring-cloud-parent</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <modules>
        <module>eureka-provider</module>
        <module>eureka-consumer</module>
        <module>eureka-server</module>
    </modules>


    <!--spring boot 環(huán)境 -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
        <relativePath/>
    </parent>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <!--spring cloud 版本-->
        <spring-cloud.version>Hoxton.SR12</spring-cloud.version>
    </properties>

    <!--引入Spring Cloud 依賴-->
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>

eureka-server工程

pom

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>spring-cloud-parent</artifactId>
        <groupId>com.liming</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>eureka-server</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- eureka-server -->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </dependency>
    </dependencies>
</project>

EurekaApp

package com.liming.eureka;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@SpringBootApplication
// 啟用EurekaServer
@EnableEurekaServer
public class EurekaApp {

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

application.yml

server:
  port: 8761

# eureka 配置
# eureka 一共有4部分 配置
# 1. dashboard:eureka的web控制臺配置
# 2. server:eureka的服務(wù)端配置
# 3. client:eureka的客戶端配置
# 4. instance:eureka的實例配置


eureka:
  instance:
    hostname: localhost # 主機名
  client:
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信

    register-with-eureka: false # 是否將自己的路徑 注冊到eureka上。eureka server 不需要的,eureka provider client 需要
    fetch-registry: false # 是否需要從eureka中抓取路徑。eureka server 不需要的,eureka consumer client 需要

測試: 訪問 localhost:8761

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

1.4 改造 Provider 和 Consumer 成為 Eureka Client

① 引入 eureka-client 相關(guān)依賴

② 完成 eureka client 相關(guān)配置

③ 啟動 測試

Provider工程

pom

<!-- eureka-client -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

ProviderApp

@EnableEurekaClient

application.yml

server:
  port: 8001


eureka:
  instance:
    hostname: localhost # 主機名
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
spring:
  application:
    name: eureka-provider # 設(shè)置當(dāng)前應(yīng)用的名稱。將來會在eureka中Application顯示。將來需要使用該名稱來獲取路徑

Consumer

pom

<!-- eureka-client -->
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>

ConsumerApp

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

application.yml

server:
  port: 9000

eureka:
  instance:
    hostname: localhost # 主機名
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
spring:
  application:
    name: eureka-consumer # 設(shè)置當(dāng)前應(yīng)用的名稱。將來會在eureka中Application顯示。將來需要使用該名稱來獲取路徑

1.5 Consumer 服務(wù) 通過從 Eureka Server 中抓取 Provider 地址,完成遠程調(diào)用

Consumer

OrderController

package com.liming.consumer.controller;

import com.liming.consumer.domain.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    RestTemplate restTemplate;

    @Autowired
    private DiscoveryClient discoveryClient;

    @GetMapping("/add/{id}")
    public Goods add(@PathVariable("id") Integer id){
        //String url="http://localhost:8000/goods/findById/"+id;
        //Goods goods = restTemplate.getForObject(url, Goods.class);

        //服務(wù)發(fā)現(xiàn)
        List<ServiceInstance> instances = discoveryClient.getInstances("EUREKA-PROVIDER");
        if(instances==null||instances.size()<=0){
            return null;
        }
        //通過某個策略拿到一個實例
        ServiceInstance serviceInstance = instances.get(0);
        String host = serviceInstance.getHost();
        int port = serviceInstance.getPort();
        System.out.println(host);
        System.out.println(port);

        String url="http://"+host+":"+port+"/goods/findById/"+id;
        Goods goods = restTemplate.getForObject(url, Goods.class);

        return goods;
    }
}

1.6 Euraka配置詳解

Eureka包含四個部分的配置

  • instance:當(dāng)前Eureka Instance實例信息配置
  • client:Eureka Client客戶端特性配置
  • server:Eureka Server注冊中心特性配置
  • dashboard:Eureka Server注冊中心儀表盤配置

1、實例信息配置

eureka:
    instance:
        hostname: localhost # 主機名
        prefer-ip-address: # 是否將自己的ip注冊到eureka中,默認false 注冊 主機名
        ip-address: # 設(shè)置當(dāng)前實例ip
        instance-id: # 修改instance-id顯示
        lease-renewal-interval-in-seconds: 30 # 每一次eureka client 向 eureka server發(fā)送心跳的時間間隔
        lease-expiration-duration-in-seconds: 90 # 如果90秒內(nèi)eureka server沒有收到eureka client的心跳包,則剔除該服務(wù)

Eureka Instance的配置信息全部保存在org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean配置類里,實際上它是com.netflix.appinfo.EurekaInstanceConfig的實現(xiàn)類,替代了netflix的com.netflix.appinfo.CloudInstanceConfig的默認實現(xiàn)。

Eureka Instance的配置信息全部以eureka.instance.xxx的格式配置。

2、客戶端特性配置

eureka:
    client:
        service-url:
       		 # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
        	defaultZone: 
        register-with-eureka: # 是否將自己的路徑 注冊到eureka上。
        fetch-registry: # 是否需要從eureka中抓取數(shù)據(jù)。

1、Eureka Client客戶端特性配置是對作為Eureka客戶端的特性配置,包括Eureka注冊中心,本身也是一個Eureka Client。
2、Eureka Client特性配置全部在org.springframework.cloud.netflix.eureka.EurekaClientConfigBean中,實際上它是com.netflix.discovery.EurekaClientConfig的實現(xiàn)類,替代了netxflix的默認實現(xiàn)。
3、Eureka Client客戶端特性配置全部以eureka.client.xxx的格式配置。

3、注冊中心端配置

eureka:
    server: #是否開啟自我保護機制,默認true
        enable-self-preservation: 
        eviction-interval-timer-in-ms: 120 2月#清理間隔(單位毫秒,默認是60*1000)
	instance:
        lease-renewal-interval-in-seconds: 30 # 每一次eureka client 向 eureka server發(fā)送心跳的時間間隔
        lease-expiration-duration-in-seconds: 90 # 如果90秒內(nèi)eureka server沒有收到eureka client的心跳包,則剔除該服務(wù)        

1、Eureka Server注冊中心端的配置是對注冊中心的特性配置。Eureka Server的配置全部在org.springframework.cloud.netflix.eureka.server.EurekaServerConfigBean里,實際上它是com.netflix.eureka.EurekaServerConfig的實現(xiàn)類,替代了netflix的默認實現(xiàn)。
2、Eureka Server的配置全部以eureka.server.xxx的格式進行配置。

4、儀表盤配置

eureka:
    dashboard:
        enabled: true # 是否啟用eureka web控制臺
        path: / # 設(shè)置eureka web控制臺默認訪問路徑

注冊中心儀表盤的配置主要是控制注冊中心的可視化展示。以eureka.dashboard.xxx的格式配置。

1.7 改造yml配置文件

改造 provider

server:
  port: 8001


eureka:
  instance:
    hostname: localhost # 主機名
    prefer-ip-address: true # 將當(dāng)前實例的ip注冊到eureka server 中。默認是false 注冊主機名
    ip-address: 127.0.0.1 # 設(shè)置當(dāng)前實例的ip
    instance-id: ${eureka.instance.ip-address}:${spring.application.name}:${server.port} # 設(shè)置web控制臺顯示的 實例id
    lease-renewal-interval-in-seconds: 3 # 每隔3 秒發(fā)一次心跳包
    lease-expiration-duration-in-seconds: 9 # 如果9秒沒有發(fā)心跳包,服務(wù)器呀,你把我干掉吧~
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
spring:
  application:
    name: eureka-provider # 設(shè)置當(dāng)前應(yīng)用的名稱。將來會在eureka中Application顯示。將來需要使用該名稱來獲取路徑

consumer

server:
  port: 9000


eureka:
  instance:
    hostname: localhost # 主機名
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
spring:
  application:
    name: eureka-consumer # 設(shè)置當(dāng)前應(yīng)用的名稱。將來會在eureka中Application顯示。將來需要使用該名稱來獲取路徑

server

server:
  port: 8761

# eureka 配置
# eureka 一共有4部分 配置
# 1. dashboard:eureka的web控制臺配置
# 2. server:eureka的服務(wù)端配置
# 3. client:eureka的客戶端配置
# 4. instance:eureka的實例配置


eureka:
  instance:
    hostname: localhost # 主機名
  client:
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka # eureka服務(wù)端地址,將來客戶端使用該地址和eureka進行通信
    register-with-eureka: false # 是否將自己的路徑 注冊到eureka上。eureka server 不需要的,eureka provider client 需要
    fetch-registry: false # 是否需要從eureka中抓取路徑。eureka server 不需要的,eureka consumer client 需要
  server:
    enable-self-preservation: false # 關(guān)閉自我保護機制
    eviction-interval-timer-in-ms: 3000 # 檢查服務(wù)的時間間隔

eureka不更新了,所以淘汰了

二、Zookeeper服務(wù)注冊與發(fā)現(xiàn)

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

有的老項目以前是dubbo,升級到微服務(wù),使用zookeeper做注冊中心。
zookeeper是一個分布式協(xié)調(diào)工具,可以實現(xiàn)注冊中心功能。

實質(zhì):注冊中心換成Zookeeper

2.1 下載

Zookeeper下載地址

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

zoo.cfg

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=F:/apache-zookeeper-3.5.6-bin/data
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1

啟動 bin目錄下

zkServer.cmd

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

zookeeper-provider

pom

<artifactId>zookeeper-provider</artifactId>

<dependencies>
    <!--springcloud 整合 zookeeper 組件-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <!--zk發(fā)現(xiàn)-->
        <artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.zookeeper</groupId>
        <artifactId>zookeeper</artifactId>
        <version>3.4.9</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

</dependencies>

yml

server:
  port: 8004

spring:
  application:
    name: zookeeper-provider
  cloud:
    zookeeper:
      connect-string: 127.0.0.1:2181 # zk地址

主啟動類

package com.liming.zk;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableDiscoveryClient //開啟發(fā)現(xiàn)客戶端
public class ProviderApp {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApp.class,args);
    }
}

業(yè)務(wù)邏輯代碼直接復(fù)制粘貼過來

zookeeper-consumer

pom

   <artifactId>zookeeper-consumer</artifactId>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

    <dependencies>
        <!--springcloud 整合 zookeeper 組件-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <!--zk發(fā)現(xiàn)-->
            <artifactId>spring-cloud-starter-zookeeper-discovery</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.zookeeper</groupId>
                    <artifactId>zookeeper</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.zookeeper</groupId>
            <artifactId>zookeeper</artifactId>
            <version>3.5.6</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

yml

server:
  port: 8005

spring:
  application:
    name: zookeeper-consumer
  cloud:
    zookeeper:
      connect-string: 127.0.0.1:2181 # zk地址

啟動類

package com.liming.zk;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;


@SpringBootApplication
@EnableDiscoveryClient
public class ConsumerApp {
    public static void main(String[] args) {
        SpringApplication.run(ConsumerApp.class,args);
    }
}

業(yè)務(wù)邏輯代碼直接復(fù)制粘貼過來

controller只改一個

List<ServiceInstance> instances = discoveryClient.getInstances("zookeeper-provider");

測試:http://localhost:8005/order/add/5

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

三、Consul服務(wù)注冊與發(fā)現(xiàn)

Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)

3.1 是什么

  • Consul 是由 HashiCorp 基于 GoLanguage 語言開發(fā)的,支持多數(shù)據(jù)中心,分布式高可用的服務(wù)發(fā)布和注冊服務(wù)軟件。
  • 用于實現(xiàn)分布式系統(tǒng)的服務(wù)發(fā)現(xiàn)與配置。
  • 使用起來也較 為簡單。具有天然可移植性(支持Linux、windows和Mac OS X);安裝包僅包含一個可執(zhí)行文件,方便部署 。
  • Consul官網(wǎng):https://www.consul.io/ Consul中文文檔:https://www.springcloud.cc/spring-cloud-consul.html

四、三個注冊中心的異同

組件 語言 cap 健康檢查 暴露接口 cloud集成
eureka java ap 支持 http 已經(jīng)集成
zookeeper java cp 支持 tcp 已經(jīng)集成
consul go cp 支持 http 已經(jīng)集成

cap

  • c:consustency 強一致性

  • a:avalibility 可用性

  • p:partition tolerance 分區(qū)容忍性文章來源地址http://www.zghlxwxcb.cn/news/detail-433982.html

到了這里,關(guān)于Eureka、Zookeeper、Consul服務(wù)注冊與發(fā)現(xiàn)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • SpringCloud(H版&alibaba)框架開發(fā)教程,使用eureka,zookeeper,consul,nacos做注冊中心——附源碼(1)

    SpringCloud(H版&alibaba)框架開發(fā)教程,使用eureka,zookeeper,consul,nacos做注冊中心——附源碼(1)

    源碼地址:https://gitee.com/jackXUYY/springboot-example 創(chuàng)建訂單服務(wù),支付服務(wù),公共api服務(wù)(共用的實體),eureka服務(wù) 1.cloud-consumer-order80 2.cloud-provider-payment8001 3.cloud-api-commons 4.cloud-eureka-server7001 5.cloud-eureka-server7002 如圖所示 修改本地host映射 修改數(shù)據(jù)庫地址為自己的地址,并初始

    2024年02月03日
    瀏覽(22)
  • Consul服務(wù)注冊發(fā)現(xiàn)集群搭建

    Consul服務(wù)注冊發(fā)現(xiàn)集群搭建

    Consul 是一種用于服務(wù)發(fā)現(xiàn)、配置和分布式一致性的開源工具和平臺。它由 HashiCorp 公司開發(fā)和維護,旨在簡化構(gòu)建和維護分布式系統(tǒng)的任務(wù)。 Consul 提供了許多功能,包括: 服務(wù)發(fā)現(xiàn) :Consul允許服務(wù)注冊和發(fā)現(xiàn)。當(dāng)服務(wù)啟動時,它可以向Consul注冊自己的位置和元數(shù)據(jù)。其他服

    2024年04月08日
    瀏覽(20)
  • docker consul 服務(wù)注冊與發(fā)現(xiàn)

    Docker consul的容器服務(wù)更新與發(fā)現(xiàn) ------------------------------------ Consul ------------------------------------ (1)什么是服務(wù)注冊與發(fā)現(xiàn) 服務(wù)注冊與發(fā)現(xiàn)是微服務(wù)架構(gòu)中不可或缺的重要組件。起初服務(wù)都是單節(jié)點的,不保障高可用性,也不考慮服務(wù)的壓力承載,服務(wù)之間調(diào)用單純的通過接

    2024年02月09日
    瀏覽(16)
  • Docker consul的容器服務(wù)注冊與發(fā)現(xiàn)

    Docker consul的容器服務(wù)注冊與發(fā)現(xiàn)

    nacos(轉(zhuǎn)給微服務(wù))、Eureka和consul一樣,也是服務(wù)注冊與發(fā)現(xiàn) 服務(wù)注冊與發(fā)現(xiàn)是微服務(wù)架構(gòu)中不可或缺的重要組件。起初服務(wù)都是單節(jié)點的,不保障高可用性,也不考慮服務(wù)的壓力承載,服務(wù)之間調(diào)用單純的通過接口訪問。直到后來出現(xiàn)了多個節(jié)點的分布式架構(gòu),起初的解決

    2024年02月11日
    瀏覽(19)
  • Docker+Consul+Registrator 實現(xiàn)服務(wù)注冊與發(fā)現(xiàn)

    Docker+Consul+Registrator 實現(xiàn)服務(wù)注冊與發(fā)現(xiàn)

    第四階段 時 ?間:2023年8月8日 參加人:全班人員 內(nèi) ?容: Docker+Consul+Registrator 實現(xiàn)服務(wù)注冊與發(fā)現(xiàn) 目錄 一、服務(wù)注冊中心引言 CAP理論是分布式架構(gòu)中重要理論: 二、服務(wù)注冊中心軟件 (一)ZooKeeper (二)Eureka (三)Etcd (四)Consul 常用的服務(wù)發(fā)現(xiàn)產(chǎn)品之間的比較: 三

    2024年02月13日
    瀏覽(85)
  • Net Core Ocelot+Consul實現(xiàn)網(wǎng)關(guān)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    Net Core Ocelot+Consul實現(xiàn)網(wǎng)關(guān)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    Ocelot是一個開源的ASP.NET Core微服務(wù)網(wǎng)關(guān),它提供了API網(wǎng)關(guān)所需的所有功能,如路由、認證、限流、監(jiān)控等。 Ocelot是一個簡單、靈活且功能強大的API網(wǎng)關(guān),它可以與現(xiàn)有的服務(wù)集成,并幫助您保護、監(jiān)控和擴展您的微服務(wù)。 以下是Ocelot的一些主要功能: 路由管理:Ocelot允許您

    2024年01月21日
    瀏覽(25)
  • Docker-consul容器服務(wù)自動發(fā)現(xiàn)與注冊

    Docker-consul容器服務(wù)自動發(fā)現(xiàn)與注冊

    docker consul 容器的自動發(fā)現(xiàn)與注冊。 什么叫做微服務(wù)(容器)注冊與發(fā)現(xiàn) 是一種分布式管理系統(tǒng),定位服務(wù)的方法。 在傳統(tǒng)架構(gòu)中,應(yīng)用程序之間直連到已知的服務(wù),設(shè)備提供的網(wǎng)絡(luò):ip網(wǎng)絡(luò),基于tcp/ip:端口 由于現(xiàn)代微服務(wù)部署,服務(wù)的動態(tài)性,數(shù)量增加了,傳統(tǒng)的基于

    2024年01月24日
    瀏覽(19)
  • eureka服務(wù)注冊和服務(wù)發(fā)現(xiàn)

    eureka服務(wù)注冊和服務(wù)發(fā)現(xiàn)

    我們要在orderservice中根據(jù)查詢到的userId來查詢user,將user信息封裝到查詢到的order中。 一個微服務(wù),既可以是服務(wù)提供者,又可以是服務(wù)消費者,因此eureka將服務(wù)注冊、服務(wù)發(fā)現(xiàn)等功能統(tǒng)一封裝到了eureka-client端

    2024年02月10日
    瀏覽(28)
  • Asp .Net Core 系列:集成 Ocelot+Consul實現(xiàn)網(wǎng)關(guān)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    Asp .Net Core 系列:集成 Ocelot+Consul實現(xiàn)網(wǎng)關(guān)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    Ocelot是一個開源的ASP.NET Core微服務(wù)網(wǎng)關(guān),它提供了API網(wǎng)關(guān)所需的所有功能,如路由、認證、限流、監(jiān)控等。 Ocelot是一個簡單、靈活且功能強大的API網(wǎng)關(guān),它可以與現(xiàn)有的服務(wù)集成,并幫助您保護、監(jiān)控和擴展您的微服務(wù)。 以下是Ocelot的一些主要功能: 路由管理:Ocelot允許您

    2024年01月17日
    瀏覽(24)
  • 【SpringCloud】Eureka原理分析、搭建Eureka服務(wù)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    【SpringCloud】Eureka原理分析、搭建Eureka服務(wù)、服務(wù)注冊、服務(wù)發(fā)現(xiàn)

    ??個人主頁: ?? 葉落閑庭 ??我的專欄:?? c語言 數(shù)據(jù)結(jié)構(gòu) javaEE 操作系統(tǒng) Redis 石可破也,而不可奪堅;丹可磨也,而不可奪赤。 當(dāng)有兩個服務(wù),第一個服務(wù)需要遠程調(diào)用第二個服務(wù),采用的方式是發(fā)起一次HTTP請求,在之前的代碼中是將服務(wù)提供者的ip和端口號硬編碼到

    2024年02月07日
    瀏覽(32)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包