Hyperledger Fabric - 无法使用四个Kafka和三个Zookeeper Ensemble启动网络

问题描述 投票:0回答:1

我正在尝试建立一个由两个组织组成的网络,每个组织都有两个同行。第三个组织有2个orderer节点,其中kakfa-zookeeper集合有4个kafka和3个zookeeper节点。

以下是我的crypto-config.yaml文件的相关部分:

OrdererOrgs:
  - Name: Orderer
    Domain: ordererOrg.example.com
    Template:
      Count: 2

以下是我的configtx.yaml文件的相关部分:

- &OrdererOrg

    Name: OrdererOrg
    ID: OrdererMSP
    MSPDir: crypto-config/ordererOrganizations/ordererOrg.example.com/msp
    Policies:
        Readers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Writers:
            Type: Signature
            Rule: "OR('OrdererMSP.member')"
        Admins:
            Type: Signature
            Rule: "OR('OrdererMSP.admin')"
      .................
Orderer: &OrdererDefaults

OrdererType: kafka
Addresses:
    - orderer0.ordererOrg.example.com:7050
    - orderer1.ordererOrg.example.com:7040
BatchTimeout: 2s
BatchSize:
    MaxMessageCount: 10
    AbsoluteMaxBytes: 99 MB
    PreferredMaxBytes: 512 KB

Kafka:
    Brokers:
        - kafka0.ordererOrg.example.com:9092
        - kafka1.ordererOrg.example.com:9092
        - kafka2.ordererOrg.example.com:9092
        - kafka3.ordererOrg.example.com:9092
...............

以下是我的Docker基本文件的相关部分:

zookeeper:
    image: hyperledger/fabric-zookeeper
    environment:
      - ZOO_SERVERS=server.1=zookeeper0.ordererOrg.example.com:2888:3888 server.2=zookeeper1.ordererOrg.example.com:2888:3888 server.3=zookeeper2.ordererOrg.example.com:2888:3888
    restart: always

kafka:
    image: hyperledger/fabric-kafka
    restart: always
    environment:
      - KAFKA_MESSAGE_MAX_BYTES=103809024 # 99 * 1024 * 1024 B
      - KAFKA_REPLICA_FETCH_MAX_BYTES=103809024 # 99 * 1024 * 1024 B
      - KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE=false
      - KAFKA_MIN_INSYNC_REPLICAS=2
      - KAFKA_DEFAULT_REPLICATION_FACTOR=3
      - KAFKA_ZOOKEEPER_CONNECT=zookeeper0.ordererOrg.example.com:2181,zookeeper1.ordererOrg.example.com:2181,zookeeper2.ordererOrg.example.com:2181

以下是我的Docker Compose文件的相关部分:

zookeeper0.ordererOrg. example.com:
    container_name: zookeeper0.ordererOrg.example.com
    extends:
      file: base/kafka-base.yaml
      service: zookeeper
    environment:
      - ZOO_MY_ID=1
    ports:
      - '2181:2181'
      - '2888:2888'
      - '3888:3888'
    networks:
      - byfn

  kafka0.ordererOrg.example.com:
    container_name: kafka0.ordererOrgvodworks.example.com
    extends:
      file: base/kafka-base.yaml
      service: kafka
    depends_on:
      - zookeeper0.ordererOrg.example.com
      - zookeeper1.ordererOrg.example.com
      - zookeeper2.ordererOrg.example.com
    environment:
      - KAFKA_BROKER_ID=0
    ports:
      - '9092:9092'
      - '9093:9093'
    networks:
      - byfn
----------------------- 
Note: The same structure is being followed for:
    - zookeeper1.ordererOrg. example.com
    - zookeeper2.ordererOrg. example.com
And
    - kafka1.ordererOrg.example.com
    - kafka2.ordererOrg.example.com
    - kafka3.ordererOrg.example.com

当我运行network start命令时,我收到以下错误消息:

✖启动业务网络定义。这可能需要一分钟......错误:尝试启动业务网络时出错。错误:没有来自任何同行的有效回复。来自尝试的对等通信的响应是错误:错误:REQUEST_TIMEOUT

当我再次运行相同的network start命令时,我得到以下内容:

✖启动业务网络定义。这可能需要一分钟......错误:尝试启动业务网络时出错。错误:没有来自任何同行的有效回复。尝试的对等通信的响应是一个错误:错误:链代码注册失败:启动链代码时超时到期tt_poc:0.0.1用于事务

并且还没有针对链代码(BNA文件)创建图像文件,因为您可以在下面的图像中看到ccenv容器和订购者日志:

enter image description here

虽然通道成功创建,但我在peer channel create命令之后也在控制台上获得了以下日志:

2019-03-25 15:20:34.567 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and rderer connections initialized 
2019-03-25 15:20:34.956 UTC [cli.common] readBlock -> INFO 002 Got status: &{SERVICE_UNAVAILABLE}

我试图提供最大的信息,但如果您还需要任何其他容器的日志,请告诉我。谢谢你的时间。

docker hyperledger-fabric hyperledger hyperledger-composer
1个回答
0
投票

我终于能够解决这个问题了。这些YAML配置没有任何问题。问题在于它缺乏资源的docker配置,而奇怪的是我在任何容器日志文件中都没有得到任何与资源相关的错误。所以,我只是增加了docker高级配置中的CPU和内存设置,如下所示:

enter image description here

在这些配置更改后,我的网络已成功启动并正常运行。

感谢我的同事@Rafiq帮我解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.