Fabric中使用CouchDB

进入测试目录

cd $GOPATH/src/github.com/hyperledger/fabric/examples/e2e_cli

docker-compose-cli.yaml添加couchdb容器

couchdb0:
  container_name: couchdb0
  image: hyperledger/fabric-couchdb
  ports:
    - "5984:5984"
    
couchdb1:
  container_name: couchdb1
  image: hyperledger/fabric-couchdb
  ports:
    - "6984:5984"

couchdb2:
  container_name: couchdb2
  image: hyperledger/fabric-couchdb
  ports:
    - "7984:5984"
    
couchdb3:
  container_name: couchdb3
  image: hyperledger/fabric-couchdb
  ports:
    - "8984:5984"

docker-compose-cli.yaml中peer容器启用couchdb

environment: 
  - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
  - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=192.168.29.132:5984
  
environment: 
  - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
  - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=192.168.29.132:5984
  
environment: 
  - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
  - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=192.168.29.132:5984

environment: 
  - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
  - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=192.168.29.132:5984

宿主机开放端口

firewall-cmd --zone=public --add-port=5984/tcp --permanent
firewall-cmd --zone=public --add-port=6984/tcp --permanent
firewall-cmd --zone=public --add-port=7984/tcp --permanent
firewall-cmd --zone=public --add-port=8984/tcp --permanent
firewall-cmd --reload

启动测试程序

./network_setup.sh up

浏览器访问

http://192.168.29.132:5984/_utils

参考文档

在HyperLedger Fabric中启用CouchDB作为State Database
http://www.cnblogs.com/studyzy/p/7101136.html
Fabric 1.0 alpha快速部署和CouchDB使用
https://zhuanlan.zhihu.com/p/25849348

你可能感兴趣的:(Fabric中使用CouchDB)