【问题标题】:What steps are necessary to add a new peer to an organization of hyperledger fabric?将新的对等节点添加到超级账本结构组织需要哪些步骤?
【发布时间】:2018-03-02 15:49:41
【问题描述】:
我正在学习使用 Hyperledger Fabric 构建网络,因为我已经使用 Hyperledger Composer 开发了一个网络,下一步是构建生产网络。我已经开始构建第一个网络示例并开始工作。我添加了 Org3 和 2 个对等方进行采样,它可以工作。
现在我想添加更多对等点,例如 peer2.org1.example.com 所以我编辑了文件以创建 peer2 并创建它,但是当 script.sh 尝试加入频道时,它启动错误:
错误:获取背书客户端通道时出错:PER:404 - 尝试连接到本地对等方时出错
原因:x509:证书对peer1.org1.example.com有效,peer1,不是peer2.org1.example.com
那么,我做错了什么?谢谢
【问题讨论】:
标签:
hyperledger-fabric
hyperledger
【解决方案1】:
当您向网络添加一个新的对等体时,您需要确保为该新的对等体正确设置所有相关的加密材料,并加下划线。首先确保将有关新对等点的信息添加到crypto-config.yaml 文件中,并使用cryptogen 工具为新对等点生成密钥和证书。接下来,您需要在启动 peer 之前设置配置以指向相关的加密材料,例如 org2 的 peer0 的配置:
peer0.org2.example.com:
container_name: peer0.org2.example.com
extends:
file: peer-base.yaml
service: peer-base
environment:
- CORE_PEER_ID=peer0.org2.example.com
- CORE_PEER_ADDRESS=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:7051
从base/peer-base.yaml 文件继承的位置:
services:
peer-base:
image: hyperledger/fabric-peer
environment:
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
# the following setting starts chaincode containers on the same
# bridge network as the peers
# https://docs.docker.com/compose/networking/
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=${COMPOSE_PROJECT_NAME}_byfn
#- CORE_LOGGING_LEVEL=ERROR
- CORE_LOGGING_LEVEL=DEBUG
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_GOSSIP_USELEADERELECTION=true
- CORE_PEER_GOSSIP_ORGLEADER=false
- CORE_PEER_PROFILE_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: peer node start
- CORE_PEER_LOCALMSPID=Org2MSP
volumes:
- /var/run/:/host/var/run/
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
- ../crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
ports:
- 9051:7051
- 9053:7053
要完成它,您需要确保配置正确的 MSP ID 和 tls 证书的路径。在您的情况下,您的新对等点只是尝试重用另一个对等点的加密材料。