【问题标题】:Questions about Raft consensus configuration关于 Raft 共识配置的问题
【发布时间】:2019-10-15 04:31:37
【问题描述】:

我有一个关于 Hyperledger Fabric 1.41 上的 raft 配置的问题,为什么在 configtx.yaml 文件中您将所有 raft 订购者配置为侦听 7050 端口,但是在 docker-compose 文件中,所有订购者都在侦听 7050,8050, 9050等?这是如何工作的?

Configtx.yaml

 Orderer:
            <<: *OrdererDefaults
            OrdererType: etcdraft
            EtcdRaft:
                Consenters:
                - Host: orderer.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                - Host: orderer2.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
                - Host: orderer3.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
                - Host: orderer4.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
                - Host: orderer5.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
            Addresses:
                - orderer.example.com:7050
                - orderer2.example.com:7050
                - orderer3.example.com:7050
                - orderer4.example.com:7050
                - orderer5.example.com:7050

Docker-compose-etcdraft2.yaml(例如 orderer3 部分)


  orderer3.example.com:
    extends:
      file: base/peer-base.yaml
      service: orderer-base
    container_name: orderer3.example.com
    networks:
    - byfn
    volumes:
        - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/msp:/var/hyperledger/orderer/msp
        - ./crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/:/var/hyperledger/orderer/tls
        - orderer3.example.com:/var/hyperledger/production/orderer
    ports:
    - 9050:7050

按照相同的模式,我认为应该更新 connection.json,包括所有带有其端口的订购者,对吧?

【问题讨论】:

    标签: hyperledger-fabric hyperledger blockchain ibm-blockchain


    【解决方案1】:

    所有订购者都在监听容器的 7050 端口。

    下面的代码将主机的端口映射到容器,因此您的主机在 9050 接收时会将流量重定向到容器的 7050 端口。

    ports:
    - 9050:7050
    

    这是因为同一个docker compose内的容器可以通过容器端口互相到达。

    这个 9050、8050 仅在您需要从 docker-compose 外部访问它们时才有用。

    【讨论】:

    • 谢谢你让我明白了很多!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 1970-01-01
    • 2020-08-22
    • 2015-02-04
    • 2019-04-30
    • 1970-01-01
    相关资源
    最近更新 更多