Hyperledger Fabric 0.6 pbft达成共识

时间:2017-06-15 22:04:52

标签: hyperledger hyperledger-fabric

我在远程计算机上安装了Hyperledger结构(v0.6)网络。我想为块的承诺启用pbft共识。我可以看到日志中启用了pbft共识,并且对等端能够连接到根节点。我在所有4个对等体上部署了我的链代码,并在一个上调用了一个事务。即使经过很长一段时间,我也没有在任何同行中看到任何提交,尽管对等体传播状态变化很多。

以下是根节点上的docker-compose.yml文件:

membersrvc:
   image: hyperledger/fabric-membersrvc
   restart: unless-stopped
   ports:
    - "7054:7054"
   expose:
     - "7054"
   volumes:
     - /var/run/docker.sock:/var/run/docker.sock
   environment:
     - MEMBERSRVC_CA_ACA_ENABLED=true
   command: membersrvc

  vp0:
     image: hyperledger/fabric-peer:latest
     restart: unless-stopped
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
        - CORE_PEER_ID=vp0
        - CORE_SECURITY_ENABLED=false
        - CORE_SECURITY_ENROLLID=test_vp0
        - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
        - CORE_PEER_PKI_ECA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TCA_PADDR=membersrvc:7054
        - CORE_PEER_PKI_TLSCA_PADDR=membersrvc:7054
        - CORE_PEER_ADDRESSAUTODETECT=true
        - CORE_PEER_NETWORKID=dev
        - CORE_LOGGING_LEVEL=debug  #critical, error, warning, notice, info, debug
        # The following section enables pbft consensus
        - CORE_PBFT_GENERAL_BATCHSIZE=1
        - CORE_PBFT_GENERAL_K=2
        - CORE_PBFT_GENERAL_MODE=classic
        - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft  # noops, pbft
        - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
        # - CORE_NOOPS_BLOCK_TIMEOUT=2s
        # - CORE_NOOPS_BLOCK_WAIT=2s
     ports:
        - "7050:7050"
        - "7051:7051"
     expose:
        - "7051"
        - "7052"
        - "7053"
     links:
        - membersrvc
     command: sh -c "sleep 20; peer node start"

这是每个对等节点上的docker-compose.yml文件:

vp1:
     image: hyperledger/fabric-peer:latest
     restart: unless-stopped
     volumes:
       - /var/run/docker.sock:/var/run/docker.sock
     environment:
        - CORE_PEER_DISCOVERY_ROOTNODE=root-node-ip:7051
        - CORE_PEER_ID=vp1
        - CORE_SECURITY_ENABLED=false
        - CORE_SECURITY_ENROLLID=test_vp1
        - CORE_SECURITY_ENROLLSECRET=MwYpmSRjupbT
        - CORE_PEER_PKI_ECA_PADDR=http://root-node-ip:7054
        - CORE_PEER_PKI_TCA_PADDR=http://root-node-ip:7054
        - CORE_PEER_PKI_TLSCA_PADDR=http://root-node-ip:7054
        - CORE_PEER_ADDRESSAUTODETECT=true
        - CORE_PEER_NETWORKID=dev
        - CORE_LOGGING_LEVEL=debug  #critical, error, warning, notice, info, debug
        # The following section enables pbft consensus
        - CORE_PBFT_GENERAL_BATCHSIZE=1
        - CORE_PBFT_GENERAL_K=2
        - CORE_PBFT_GENERAL_MODE=classic
        - CORE_PEER_VALIDATOR_CONSENSUS_PLUGIN=pbft  # noops, pbft
        - CORE_PBFT_GENERAL_TIMEOUT_REQUEST=10s
        #- CORE_NOOPS_BLOCK_TIMEOUT=2s
        #- CORE_NOOPS_BLOCK_WAIT=2s
     ports:
        - "7050:7050"
        - "7051:7051"
     expose:
        - "7051"
        - "7052"
        - "7053"
     command: sh -c "sleep 20; peer node start"

任何人都可以帮忙。感谢。

1 个答案:

答案 0 :(得分:0)

我认为对等方无法使用其docker发布的ip地址执行握手。我通过将CORE_PEER_ADDRESSAUTODETECT设置为false来关闭自动检测,并让对等体通过将CORE_PEER_ADDRESS设置为实例的公共IP和CORE_PEER_DISCOVERY_ROOTNODE到ip来发现对方对等体与其分类帐同步的验证器的地址。