Вопросы о согласованной конфигурации Raft - PullRequest
0 голосов
/ 29 мая 2019

У меня есть вопрос о конфигурации плота в Hyperledger Fabric 1.41, почему в файле configtx.yaml вы настраиваете все ваши плотские заказчики для прослушивания через порт 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

По той же схеме Iдумаю, что connection.json должен быть обновлен, включая всех заказчиков с его портом, верно?

1 Ответ

2 голосов
/ 29 мая 2019

Все заказчики прослушивают порт 7050 контейнеров.

Приведенный ниже код сопоставляет порт хоста с контейнером, поэтому ваш хост будет перенаправлять трафик на порт контейнера 7050 при получении на 9050.

ports:
- 9050:7050

Это потому, что контейнеры внутри одного и того же докера могут соединяться друг с другом, используя порт контейнера.

Эти 9050, 8050, были бы полезны только в том случае, если вам нужно связаться с ними из-за пределов соединения.

...