首页 文章

Hyperledger Fabric:Orderer客户端无法连接到orderer.example.com

提问于
浏览
2

我是hyperledger fabric的新手,我正在尝试使用hyperledger fabric从头开始创建一个样本区块链网络 . 为此,我配置了“crypto-config.yaml”文件,并通过对“cryptogen”工具运行它来生成相应组织的证书 . 我还通过配置“configtx.yaml”文件并针对configtxgen工具运行它来生成相应的“通道工件” . 然后我修改了“docker-compose-cli.yaml”文件和“docker-compose-base”文件 .

现在,为了引导网络,我运行了以下docker命令:

docker-compose -f docker-compose-cli.yaml up

然后我执行了以下命令:

docker exec -it cli bash
export CHANNEL_NAME=testChannel
peer channel create -o orderer.example.com:7050 -c testChannel -f ./channel-artifacts/testChannel.tx

在执行“peer channel create”命令时,我收到以下错误:

Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050: failed to create new connection: context deadline exceeded

我不确定为什么会发生这种错误 . 我在OrdererDefaults中的Address部分的配置(在configtx.yaml文件中)是:

Ordertype:
     - solo

Addresses:
     - orderer.example.com:7050

因此,如果我遗漏某些内容以便清除“同行 Channels 创建”问题,请告诉我 .

1 回答

  • 0

    做一个 docker ps 并查看订货人是否启动并运行如果不执行 docker logs orderer.example.com 并检查订货人日志,通常订货人日志会清楚地显示已发生的事情,阅读日志并解决问题 . 这就是我做的

    而不是创建一个同行首先进入其中并创建一个 Channels ,我建议你先创建 Channels ,然后加入同伴

    创建 Channels

    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.tracexyz.com/msp" peer0.org1.tracexyz.com peer channel create -o orderer.tracexyz.com:7050 -c cheeseproduction -f /etc/hyperledger/configtx/channel.tx

    将对等体0添加到通道

    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.tracexyz.com/msp" peer0.org1.tracexyz.com peer channel join -b cheeseproduction.block

    从对等1获取

    docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.tracexyz.com/msp" peer1.org1.tracexyz.com peer channel fetch config -o orderer.tracexyz.com:7050 -c cheeseproduction

    将peer 1加入 Channels

    docker exec -e "CORE_PEER_LOCALMSPID=Org1MSP" -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.tracexyz.com/msp" -e "CORE_PEER_ADDRESS=peer1.org1.tracexyz.com:7061" peer0.org1.tracexyz.com peer channel join -b cheeseproduction.block

    这就是我将两个对等体连接到一个通道的方式 . 我的组织名称是 tracexyz (tracexyz而不是示例),我的 Channels 名称是 cheeseproduction

    我想你可以用你自己的 Value 取代那些

    做完这些后进入同行

    docker exec -it cli bash

    它将带你进入默认对等体 peer0.org1

    然后执行 peer channel list 以查看peer0加入的 Channels

    你会看到它会列出 cheeseproduction

相关问题