天天看點

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

目錄

      • first-network 1.2.1
      • e2e_cli git1.2.1官方版本跑例子時
      • e2e_cli定制版1.2.1更新時
      • 帶舊資料更新到1.2
        • 嘗試1
        • 嘗試2
      • 總結
      • 其他
        • configtxgen等工具版本
        • kafka/zookeeper版本問題
        • ccenv版本問題

first-network 1.2.1

無問題

e2e_cli git1.2.1官方版本跑例子時

docker tag 1.2.1鏡像latest标簽

order/peer加如下環境變量

GODEBUG=netdns=go
           

啟動還是報錯

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

Error: error endorsing query: rpc error: code = Unknown desc = Failed evaluating policy on signed data during check policy on channel [mychannel] with policy [/Channel/Application/Writers]: [Failed to reach implicit threshold of 1 sub-policies, required 1 remaining] - proposal response:

通過搜尋引擎找到了解決方案 修改policies:fabric1-2下e2e-cli問題記錄

按提示修改 e2e_cli下的configtx.yaml,在Org3處進行添加Org3MSP.member,如下。

Policies:
	Readers:
	Type: Signature
	Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client', 'Org3MSP.member')"
	Writers:
	Type: Signature
	Rule: "OR('Org3MSP.admin', 'Org3MSP.client', 'Org3MSP.member')"
	Admins:
	Type: Signature
	Rule: "OR('Org3MSP.admin')"
           

e2e_cli定制版1.2.1更新時

域名改成公司配置設定域名,通道名改成bgihealth,mycc也相應變了下

先單純更改域名啟動改造後的e2e_cli-1.2.1項目

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

Error: got unexpected status: FORBIDDEN – Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

Evaluation Failed: Only 0 policies were satisfied, but needed 1 of

Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied

對比yaml檔案,發現EnableNodeOUs屬性不同

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

更改yaml配置,重新生成證書和tx檔案,問題解決

參考過的資料:

  • stackoverflow
  • 如何更新CHANNEL的ORDERER位址
  • 超級賬本HYPERLEDGER:FABRIC部署過程時遇到的問題彙總

帶舊資料更新到1.2

帶舊資料更新時,因為1.1.1的證書生成沒有使能EnableNodeOUs特性,

切換成1.2鏡像時繼續用1.0.6的證書,報錯如下

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

Error: got unexpected status: BAD_REQUEST – cannot enable application capabilities without orderer support first

替換成1.2鏡像時同時切換1.2證書,又報錯如下

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

Error: got unexpected status: FORBIDDEN – Failed to reach implicit threshold of 1 sub-policies, required 1 remaining: permission denied

嘗試1

方法無效
           

注釋掉

signConfigtxAsPeerOrg 1 config_update_in_envelope.pb

# Prepare to sign the update as the PeerOrg2.Admin

setGlobals 0 2

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

無用

隻注釋掉

signConfigtxAsPeerOrg 1 config_update_in_envelope.pb

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

嘗試2

比對1.0.6,1.1.1,1.2.1版本的configtx.yaml和crypto-config.yaml
           

考慮到crypto-config.yaml的1.1.1比1.0.6多了個EnableNodeOUs

還有1.2.1多了幾個policies

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

後續突然想到導出更新過程中的config.json和modified_config.json,比對正常資料更新,發現舊資料還缺少V1_1的屬性。

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

可能是搭建時用的是1.0.6版本工具建立的tx檔案。

意識到一并更新V1_1屬性和1.2看看

終于更新成功了。 測試讀寫也正常了

總結

我本次問題的主要原因,是因為腳本從1.0.6修改過來,缺少了一些屬性,例如polices 、EnableNodeOUs。這些屬性影響到了tx檔案、證書,最終寫在了區塊裡。而我們要做的是修正yaml檔案後再使這些屬性生效:清除區塊鍊資料重新搭建也可,保持舊資料更新配置塊也可。

其他

configtxgen等工具版本

更新時保持舊版本即可。更新後建立新通道檔案時要對應更新後的版本。
configtx.yaml  crypto-config.yaml  configtxgen的版本
           

kafka/zookeeper版本問題

恢複1.1.1環境,出錯如下:zookeeper中執行不了 docker-entrypoint.sh

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

後來發現是kafka/zookeeper被本機生成編譯過,latest标簽對應了舊版1.0.6

ccenv版本問題

先前複制了測試環境244伺服器的舊資料,在213伺服器上解決了更新屬性的問題。然後切回244驗證時,碰到如下問題

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

智能合約啟動報錯如下:

超級賬本fabric帶持久化資料更新到1.2時所遇的 implicit threshold 問題

後對比兩台伺服器鏡像,發現ccenv版本不同。213并沒有1.2的版本,而244的latest标簽頁是打在1.4上。

将兩台伺服器的ccenv latest鏡像對應到1.2後,啟動并更新成功。

繼續閱讀