Hyperledger Fabric - 从另一台主机加入对等体
Hyperledger Fabric - Join peer from another host
我的设置如下:
- 2 Linux 个虚拟机 运行 在 VirtualBox 中;
- 两台主机都参与了 Docker Swarm;
- 主机 1 包括:1 个订购者、1 个组织、2 个节点和一个 cli 容器;
- 主机 2 包括:1 个组织和 2 个同行;
- 我正在使用以下教程作为参考 (https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabric-multi-org)
我实际上如何 运行 Fabric 网络:
- 我在两台主机上生成相同的通道工件和加密配置文件。
- 在主机 2 上启动 fabric - 与对等节点、couchdbs 和 ca;
- 在主机 1 上启动结构;
- 正在主机 1 上生成频道;从主机 1 加入对等点并更新锚点对等点;
- 在检查覆盖群网络时,我能够看到每个主机都可用的对等点和容器;
我在尝试让主机 2 的对等点加入频道时出现问题。我正在尝试通过主机 1 上的 cli 将它们添加到频道。
但我收到以下错误:
Error: error getting endorser client for channel: endorser client failed to connect to peer0.sponsor.example.com:7051: failed to create new connection: context deadline exceeded
这是我的 docker-compose-cli.yaml 主机 1:
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer.example.com:
peer0.manager.example.com:
peer1.manager.example.com:
peer0.sponsor.example.com:
peer1.sponsor.example.com:
networks:
example:
services:
orderer.example.com:
extends:
file: base/docker-compose-base-1.yaml
service: orderer.example.com
container_name: orderer.example.com
networks:
- example
peer0.manager.example.com:
container_name: peer0.manager.example.com
extends:
file: base/docker-compose-base-1.yaml
service: peer0.manager.example.com
networks:
- example
peer1.manager.example.com:
container_name: peer1.manager.example.com
extends:
file: base/docker-compose-base-1.yaml
service: peer1.manager.example.com
networks:
- example
cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_LEVEL=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.manager.example.com:7051
- CORE_PEER_LOCALMSPID=ManagerMSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/users/Admin@manager.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.manager.example.com
- peer1.manager.example.com
networks:
- example
节点无法连接到peer0.sponsor.proa.com。这可能是由于您根据自己的喜好对网络地址进行了一些更改,这是您自定义的吗?我没有遵循本教程,但在遵循 this one.
自定义第一个网络示例时,我 运行 遇到了一些类似的问题
确保您的对等地址在 configtx.yaml、cryptoconfig.yaml、docker-compose- 上配置正确cli.yaml 和 docker-compose-base.yaml 以及 peer-base.yaml 如果您更改了网络名称。
如果对等点的地址没有在这些文件中检出,您可能需要再次生成通道交易并重新启动网络,因为区块链中存在的通道配置不匹配您当前的网络配置。
我犯了一个非常简单的错误:我没有将生成的密码 material 从一台主机复制到另一台主机;我在所有主机上生成新的加密 materials,认为它们是相同的。
我的设置如下:
- 2 Linux 个虚拟机 运行 在 VirtualBox 中;
- 两台主机都参与了 Docker Swarm;
- 主机 1 包括:1 个订购者、1 个组织、2 个节点和一个 cli 容器;
- 主机 2 包括:1 个组织和 2 个同行;
- 我正在使用以下教程作为参考 (https://hyperledger.github.io/composer/latest/tutorials/deploy-to-fabric-multi-org)
我实际上如何 运行 Fabric 网络:
- 我在两台主机上生成相同的通道工件和加密配置文件。
- 在主机 2 上启动 fabric - 与对等节点、couchdbs 和 ca;
- 在主机 1 上启动结构;
- 正在主机 1 上生成频道;从主机 1 加入对等点并更新锚点对等点;
- 在检查覆盖群网络时,我能够看到每个主机都可用的对等点和容器;
我在尝试让主机 2 的对等点加入频道时出现问题。我正在尝试通过主机 1 上的 cli 将它们添加到频道。
但我收到以下错误:
Error: error getting endorser client for channel: endorser client failed to connect to peer0.sponsor.example.com:7051: failed to create new connection: context deadline exceeded
这是我的 docker-compose-cli.yaml 主机 1:
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
version: '2'
volumes:
orderer.example.com:
peer0.manager.example.com:
peer1.manager.example.com:
peer0.sponsor.example.com:
peer1.sponsor.example.com:
networks:
example:
services:
orderer.example.com:
extends:
file: base/docker-compose-base-1.yaml
service: orderer.example.com
container_name: orderer.example.com
networks:
- example
peer0.manager.example.com:
container_name: peer0.manager.example.com
extends:
file: base/docker-compose-base-1.yaml
service: peer0.manager.example.com
networks:
- example
peer1.manager.example.com:
container_name: peer1.manager.example.com
extends:
file: base/docker-compose-base-1.yaml
service: peer1.manager.example.com
networks:
- example
cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
#- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_LEVEL=INFO
- CORE_PEER_ID=cli
- CORE_PEER_ADDRESS=peer0.manager.example.com:7051
- CORE_PEER_LOCALMSPID=ManagerMSP
- CORE_PEER_TLS_ENABLED=true
- CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/server.crt
- CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/server.key
- CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/peers/peer0.manager.example.com/tls/ca.crt
- CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/manager.example.com/users/Admin@manager.example.com/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
command: /bin/bash
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/chaincode
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
- orderer.example.com
- peer0.manager.example.com
- peer1.manager.example.com
networks:
- example
节点无法连接到peer0.sponsor.proa.com。这可能是由于您根据自己的喜好对网络地址进行了一些更改,这是您自定义的吗?我没有遵循本教程,但在遵循 this one.
自定义第一个网络示例时,我 运行 遇到了一些类似的问题确保您的对等地址在 configtx.yaml、cryptoconfig.yaml、docker-compose- 上配置正确cli.yaml 和 docker-compose-base.yaml 以及 peer-base.yaml 如果您更改了网络名称。
如果对等点的地址没有在这些文件中检出,您可能需要再次生成通道交易并重新启动网络,因为区块链中存在的通道配置不匹配您当前的网络配置。
我犯了一个非常简单的错误:我没有将生成的密码 material 从一台主机复制到另一台主机;我在所有主机上生成新的加密 materials,认为它们是相同的。