我可以运行Hyperledger Fabric 1.0"第一个网络"样品很好。
现在我正尝试将CouchDB持久性添加到此示例中,如https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#using-couchdb和https://hyperledger-fabric.readthedocs.io/en/latest/build_network.html#a-note-on-data-persistence所述
我在fabric-samples / first-network / byfn.sh中编辑networkUp()函数,改变以下行:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
为:
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d 2>&1
我还编辑文件fabric-samples / first-network / docker-compose-couch.yaml更改块:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
ports:
- "5984:5984"
networks:
- byfn
为:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
ports:
- "5984:5984"
networks:
- byfn
volumes:
- /var/hyperledger/couchdb0:/opt/couchdb/data
当我使用命令运行它时:
yes | sudo ./byfn.sh -m generate
yes | sudo ./byfn.sh -m up
在它列出'频道" mychannel"之后已成功创建',我收到错误:
UTC [grpc] Printf -> DEBU 003 grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: Error while dialing dial tcp 172.18.0.8:7051: getsockopt: connection refused"; Reconnecting to {peer0.org1.example.com:7051 <nil>}
任何帮助非常感谢。
提前致谢!
答案 0 :(得分:0)
这个问题在RHEL 7.3上没有发生,所以我按照http://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-update-centos-7-07-17-2-to-centos-7-3.html的说明将我的CentOS从7.2更新到7.3,我的问题得到了解决。
做出改变:
1)创建文件夹
mkdir /home/vagrant/db0
2)在byfn.sh的networkUp()中更改:
# CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f $COMPOSE_FILE up -d 2>&1
CHANNEL_NAME=$CHANNEL_NAME TIMEOUT=$CLI_TIMEOUT docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d 2>&1
3)增加了最后两个&#34;卷:&#34; docker-compose-couchdb.yaml中的行:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
ports:
- "5984:5984"
networks:
- byfn
volumes:
- /home/vagrant/db0:/opt/couchdb/data
答案 1 :(得分:0)
docker容器以用户couchdb开头。因此,当您尝试共享数据目录的卷时,docker容器会尝试创建此文件夹并将所有权分配给root。所以我认为用户变量应该在dockerfile中保留为空,而不是将其指定为couchdb。我的环境是RHEL 7.3版(Maipo)。为了解决这个问题,我使用以下命令启动了容器,并将用户指定为root
docker run --rm -itd --name couchdb0 --user root \
--publish 5984:5984 \
--volume /var/hyperledger/couchdb0:/opt/couchdb/data \
hyperledger/fabric-couchdb:x86_64-1.0.0