最近在联调fabirc网络遇到了很多坑,主要是对fabric不够熟悉,所以解决问题的时候即使看到了错误信息,也不能很快的确定具体是那里出现了问题,而且问题确实谷歌不到,所以简单记录一下。
CA Certificate is not valid, (SN: 234551506279605485472670524472959491447): could not obtain certification chain: the supplied identity is not valid: x509: certificate has expired or is not yet valid"
证书过期,错误提示的已经很明显了,但是仔细看错误信息显示过期时间还没到(这里我没把错误截全),但是还重新生成了证书,依然出现过期的错误。
解决办法:
Error: proposal failed (err: bad proposal response 500)
加入通道的时候出现这个错误,往往是重复加入channel了,这个问题主要是吃亏在没仔细分析错误志,出现问题还是先不要复制粘贴百度。
解决办法:
使用fabric-go-sdk 实例化时报错:users not found
读取config.yml文件来创建一个sdk 的实例发生的error,排除自己方法传参无误,配置文件的用户名和orgname 也没有问题,谷歌也查不到,只能对着源码中的示例一个个去对比,对比哪里缺少用户信息的配置。
解决办法:
organizations
org1:
users:
Admin:
cert:
path: ****.pem
User1:
cert:
path: ****.pem
sending deploy transaction proposal failed: Transaction processing for endorser [peer0.org-maggie.ansible-example.ee-chain.com:7051]: Endorser Client Status Code: (2) CONNECTION_FAILED. Description: dialing connection timed out [peer0.org-maggie.ansible-example.ee-chain.com:7051]
sdk 实例化链码时出现的错误:先去看了另一台机器上的7051端口的进程是不是正常启动的,确认了hosts 文件也没有问题,仔细想想peer节点部署都是ansible统一处理的,如果有问题的话,之前的步骤应该是不会成功的。而且为什么是其中一台机器链接正常的。
解决办法:
peer0.org-maggie.ansible-example.ee-chain.com:7051
对应的机器配置entityMatchers:
peer:
- pattern: (\w*)org-martin(\w*)
urlSubstitutionExp: 47.96.230.111:7051
eventUrlSubstitutionExp: 47.96.230.111:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org-martin.ansible-example.ee-chain.com
mappedHost: peer0.org-martin.ansible-example.ee-chain.com
- pattern: (\w*)org-maggie(\w*)
urlSubstitutionExp: 121.196.210.111:7051
eventUrlSubstitutionExp: 121.196.210.111:7053
sslTargetOverrideUrlSubstitutionExp: peer0.org-maggie.ansible-example.ee-chain.com
mappedHost: peer0.org-maggie.ansible-example.ee-chain.com
orderer:
- pattern: (\w*)org-martin(\w*)
urlSubstitutionExp: 47.96.230.111:7050
sslTargetOverrideUrlSubstitutionExp: orderer0.org-martin.ansible-example.ee-chain.com
mappedHost: orderer0.org-martin.ansible-example.ee-chain.com
sending deploy transaction proposal failed: Transaction processing for endorser [121.196.210.111:7051]: Endorser Client Status Code: (23) CHAINCODE_NAME_NOT_FOUND. Description: cannot get package for chaincode (scc:1.0)
实例化链码链码时出现的问题:基于上一个坑,配置文件没错的情况下,错误信息是某台机器上没有这个包
解决办法:
Got error: lscc.getinstalledchaincodes failed: SendProposal failed: Transaction processing for endorser [47.96.230.107:7051]: Chaincode status Code: (500) UNKNOWN. Description: access denied for [getinstalledchaincodes]: Failed verifying that proposal's creator satisfies local MSP principal during channelless check policy with policy [Admins]: [This identity is not an admin]
Chaincode status Code: (500) UNKNOWN. Description: instantiation policy violation: signature set did not satisfy policy
安装链码是报错:很明显的错误没有权限
解决办法:
DEBU Reading pk from config, unable to retrieve from cert: Could not find matching key for SKI: Failed getting key for SKI [[219 34 214 116 87 3 37 94 43 155 20 148 235 6 177 47 169 64 44 1 166 137 51 101 73 144 111 195 166 12 245 133]]: Key with SKI db22d6745703255e2b9b1494eb06b12fa9402c01a689336549906fc3a60cf585 not found in /tmp/ebcgateway-msp/keystore
解决办法:
Error: failed to create deliver client: orderer client failed to connect to orderer0.org-one.contract.ee-chain.com:7050: failed to create new connection: context deadline exceeded
解决办法:
因为使用的是阿里云的机器所有各个节点使用的端口需要设置安全组
2018-12-11 12:44:16.803 CST [ledgermgmt] initialize -> INFO 003^[[0m Initializing ledger mgmt
2018-12-11 12:44:16.803 CST [kvledger] NewProvider -> INFO 004^[[0m Initializing ledger provider
^[[31m2018-12-11 12:44:16.834 CST [couchdb] CreateSystemDatabasesIfNotExist -> ERRO 005^[[0m Error during CouchDB CreateDatabaseIfNotExist() for system dbName: _users error: json: cannot unmarshal string into Go struct field DBInfo.purge_seq of type int
^[[31m2018-12-11 12:44:16.834 CST [couchdb] VerifyCouchConfig -> ERRO 006^[[0m Unable to connect to CouchDB, error: json: cannot unmarshal string into Go struct field DBInfo.purge_seq of type int Check the admin username and password.
panic: Error in instantiating ledger provider: Unable to connect to CouchDB, error: json: cannot unmarshal string into Go struct field DBInfo.purge_seq of type int Check the admin username and password.
在peer节点的日志上看到无法连接到couchdb,但是前几天还好好的,确认了自己的用户名和密码是正确的,怀疑是版本的问题,所以看了当前的couchdb 版本,和上周成功的网络,他们版本是存在差异的,在不知道那个是对的情况下,参考了fabric 1.2 docker镜像 中的couchdb 版本使用的是2.1.1
解决办法:
1、yum 安装时使用2.1.1版本即可
yum install couchdb-2.1.2-1.el7
环境问题
网络连接问题:
证书问题:
链码问题:
[][]byte{[]byte("init"), []byte("A"), []byte("100"), []byte("B"), []byte("200")}
的形式配置文件问题:
entityMatchers,organizations,orderers,peers
这类的复数的形式配置项的还是老老实实全部都填上另外重要的事情说三遍!
仔细看错误日志!
仔细看错误日志!
仔细看错误日志!
还有一部分问题,过程中没有记录,不愿破坏现在的测试网络,所以就没有复盘,下次记录:P
原理问题之后复习了fabirc 的理论知识在做补充