我正在学习使用 Hyperlegder Fabric 构建网络,因为我已经使用 Hyperledger Composer 开发了一个网络,下一步是构建生产网络。我已经开始构建第一个网络示例并开始工作。我已经添加了 Org3 和 2 个对等点来进行采样,并且它可以工作。
现在我想添加更多对等点,例如peer2.org1.example.com,因此我编辑了文件以创建peer2并创建了它,但是当script.sh尝试加入频道时,它会启动错误:
错误:获取背书者客户端通道时出错:PER:404 - 尝试连接到本地对等方时出错
原因:x509:证书对peer1.org1.example.com、peer1有效,对peer2.org1.example.com无效
那么,我到底做错了什么?谢谢
当您向网络添加新对等点时,您需要确保正确设置为该新对等点下划线的所有相关加密材料。首先确保将有关新对等点的信息添加到crypto-config.yaml
文件并使用cryptogen
为新对等点生成密钥和证书的工具。接下来,您需要在启动对等点之前设置配置以指向相关的加密材料,例如 org2 的对等点 0 的配置:
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
file:
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 证书路径。在您的情况下,您的新对等点只是尝试重用另一个对等点的加密材料。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)