首页 > 解决方案 > 连接客户端peer失败,请检查配置和peer状态

问题描述

Explorer 3.7 和fabric 版本1.2.0 有一个错误。

控制台显示错误:

    为网络启动同步过程:[dev] 和客户端:[client]
    >>>>>>>>>>>>>>>>>>>>>>
    错误:['连接客户端对等失败,请检查配置和对等状态']
    >>>>>>>>>>>>>>>>>>>>>>

blockchain-explorer/logs/sync/app/app.log 显示错误

    [2018-09-28 13:41:10.692] [DEBUG] FabricClient - 通道 [mychannel] >> e520121a6edb2794eb85505d5f5319d29286acb43d0280e0f0f75a130e79889c 的通道创世哈希
    [2018-09-28 13:41:10.692] [DEBUG] FabricClient - 初始化通道>> mychannel
    [2018-09-28 13:41:10.723] [DEBUG] FabricClient - 将客户端 [client-1] 默认排序器设置为 >> grpcs://orderer.yx.com:7050
    [2018-09-28 13:41:10.724] [DEBUG] FabricClient - 管理员对等未找到 grpcs://peer0.org1.yx.com:7051
    [2018-09-28 13:49:22.980] [DEBUG] 同步 - 启动同步器

我的 config.json 文件是:

    {
      “网络配置”:{
        “开发”:{
          “版本”:“1.0”,
          “客户”:{
            “客户”: {
              “tlsEnable”:是的,
              “组织”:“Org1MSP”,
              “频道”:“我的频道”,
              “凭据存储”:{
                "路径": "./tmp/credentialStore_Org1/credential",
                “加密商店”:{
                  “路径”:“./tmp/credentialStore_Org1/crypto”
                }
              }
            }
          },
          “渠道”:{
            “我的频道”:{
              “同行”:{
                “peer0.org1.yx.com”:{}
              },
              “联系”: {
                “暂停”: {
                  “同行”:{
                    “背书人”:“6000”,
                    "eventHub": "6000",
                    “事件注册”:“6000”
                  }
                }
              }
            }
          },
          “组织”:{
            “组织1MSP”:{
              "mspid": "Org1MSP",
              “全路径”:假,
              “adminPrivateKey”:{
                “小路”:
                  “/root/blockchain-explorer/examples/dockerConfig/crypto/peerOrganizations/org1.yx.com/users/Admin@org1.yx.com/msp/keystore”
              },
              “签名证书”:{
                “小路”:
                  “/root/blockchain-explorer/examples/dockerConfig/crypto/peerOrganizations/org1.yx.com/users/Admin@org1.yx.com/msp/signcerts”
              }
            },
            “订购者MSP”:{
              "mspid": "OrdererMSP",
              “adminPrivateKey”:{
                “路径”:“/root/blockchain-explorer/examples/dockerConfig/crypto/ordererOrganizations/yx.com/users/Admin@yx.com/msp/keystore”
              }
            }
          },
          “同行”:{
            “peer0.org1.yx.com”:{
              “tlsCACerts”:{
                “路径”:“/root/blockchain-explorer/examples/dockerConfig/crypto/peerOrganizations/org1.yx.com/peers/peer0.org1.yx.com/tls/ca.crt”
              },
              "url": "grpcs://peer0.org1.yx.com:7051",
              "eventUrl": "grpcs://peer0.org1.yx.com:7053",
              “grpc选项”:{
                “ssl 目标名称覆盖”:“peer0.org1.yx.com”
              }
            }
          },
          “订购者”:{
            “orderer.yx.com”:{
              “网址”:“grpcs://orderer.yx.com:7050”
            }
          }
        },
        "configtxgenToolPath": "/root/blockchain-explorer/bin",
        “许可证”:“Apache-2.0”
      }
    }

CentOS7 中的 hosts 文件是

    192.168.2.220 orderer.yx.com
    192.168.2.221 cli.yx.com
    192.168.2.222 peer0.org1.yx.com
    192.168.2.223 peer1.org1.yx.com
    192.168.2.224 peer0.org2.yx.com

标签: hyperledger-fabrichyperledger-explorer

解决方案


您可以尝试将 url、peer 的 eventUrl、orderer 更改为 ip 地址,如下所示:

"peer0.org1.yx.com": {
          "tlsCACerts": {
            "path": "/root/blockchain-explorer/examples/dockerConfig/crypto/peerOrganizations/org1.yx.com/peers/peer0.org1.yx.com/tls/ca.crt"
          },
          "url": "grpcs://192.168.2.222:7051",
          "eventUrl": "grpcs://192.168.2.222:7053",
          "grpcOptions": {
            "ssl-target-name-override": "peer0.org1.yx.com"
          }
        }

推荐阅读