5 peer chaincode install安装chaincode时出错

背景:部署了2peer+1orderer的区块链网络,两个peer主机各只有一个peer。我为peer0.org1安装chaincode安装成功了,

当我尝试为peer0.org2安装时执行如下命令

CORE_PEER_LOCALMSPID="Org2MSP" 
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt 
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp 
CORE_PEER_ADDRESS=peer0.org2.example.com:7051
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/community

出现了报错信息如下:

root@aa72dc3f146f:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/community

Error: Error getting endorser client chaincode: PER:404 - Error trying to connect to local peer

/opt/gopath/src/github.com/hyperledger/fabric/peer/common/common.go:116 github.com/hyperledger/fabric/peer/common.GetEndorserClient

/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/common.go:240 github.com/hyperledger/fabric/peer/chaincode.InitCmdFactory

/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:166 github.com/hyperledger/fabric/peer/chaincode.chaincodeInstall

/opt/gopath/src/github.com/hyperledger/fabric/peer/chaincode/install.go:54 github.com/hyperledger/fabric/peer/chaincode.installCmd.func1

/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:599 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).execute

/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:689 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).ExecuteC

/opt/gopath/src/github.com/hyperledger/fabric/vendor/github.com/spf13/cobra/command.go:648 github.com/hyperledger/fabric/vendor/github.com/spf13/cobra.(*Command).Execute

/opt/gopath/src/github.com/hyperledger/fabric/peer/main.go:118 main.main

/opt/go/src/runtime/proc.go:192 runtime.main

/opt/go/src/runtime/asm_amd64.s:2087 runtime.goexit

Caused by: x509: certificate is valid for peer0.org1.example.com, peer0, not peer0.org2.example.com


其中生成公私钥的配置文件cryto-config.yaml

OrdererOrgs:
  - Name: Orderer
    Domain: example.com
    Specs:
      - Hostname: orderer
PeerOrgs:
  - Name: Org1
    Domain: org1.example.com
    Template:
      Count: 1
    Users:
      Count: 1
  - Name: Org2
    Domain: org2.example.com
    Template:
      Count: 1
    Users:
      Count: 1
请先 登录 后评论

2 个回答

冯翔 - 高级系统架构师

你是通过什么方式运行的,docker还是直接运行。你可以检查下,两个peer节点是否已经运行,是否存在端口冲突图。

请先 登录 后评论
fangdengfu

错误:Error getting endorser client chaincode: PER:404 - Error trying to connect to local peer

可能出现问题:

1、程序崩了,所以404

2、你如果是在cli容器中执行的该命令,你看看cli的compose。yaml文件里面有没有配置peer0.org2(应该不会是这个,因为你的环境已经起来了)

2、如果你是命令行直接跑的,看看你host有没有配置peer0.org2这个域名


请先 登录 后评论