使用 couchdb hyperledger fabric 时加入对等通道时出错
Error join peer channel when using couchdb hyperledger fabric
我正在与两个对等方一起使用一个简单的基本网络,并创建一个通道。很好,但是当我尝试添加 couch db 功能时,returns 错误:
Channel created, joining Org1...
Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 172.22.0.5:7051: connect: connection refused"
只有在启用 couch db 时才会发生这种情况,如果没有 couchdb,它会创建通道并将其加入两个对等点。
当我在没有 couchdb 的情况下启动容器时,我使用的是:
docker-compose -f docker-compose-cli.yaml up -d
还有 couchdb
docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d
docker-compose-couch.yaml包含:
version: '2'
networks:
byfn:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5984:5984"
networks:
- byfn
peer0.org1.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
depends_on:
- couchdb0
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "7984:5984"
networks:
- byfn
peer0.org2.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
depends_on:
- couchdb1
有什么想法吗?使用couchdb时有什么原因导致连接错误吗?
谢谢
似乎在与对等点连接时出现了一些问题,因此一旦网络中断,请删除所有容器和卷。然后再次开始网络设置。
这次尝试单独启动 docker 个容器,即首先使用以下命令启动所有其他容器:
docker-compose -f docker-compose-cli.yaml up -d
然后,启动您的 couchdb 容器,因为当 couchdb 启动并尝试搜索对等容器时,您的对等容器可能未启动。所以在所有其他容器都启动之后使用这个:
docker-compose -f docker-compose-couch.yaml up -d
我遇到了同样的问题,我修复了它,在加入频道时增加了一点延迟。
如果脚本在容器启动后立即创建并加入频道,则 couchdb 容器是 运行 而不是其中的数据库。
我的问题已解决,在我的脚本中创建通道之前添加 "sleep 2" 以确保 couchdb 数据库已准备好处理请求。
我正在与两个对等方一起使用一个简单的基本网络,并创建一个通道。很好,但是当我尝试添加 couch db 功能时,returns 错误:
Channel created, joining Org1...
Error: error getting endorser client for channel: endorser client failed to connect to peer0.org1.example.com:7051: failed to create new connection: connection error: desc = "transport: error while dialing: dial tcp 172.22.0.5:7051: connect: connection refused"
只有在启用 couch db 时才会发生这种情况,如果没有 couchdb,它会创建通道并将其加入两个对等点。
当我在没有 couchdb 的情况下启动容器时,我使用的是:
docker-compose -f docker-compose-cli.yaml up -d
还有 couchdb
docker-compose -f docker-compose-cli.yaml -f docker-compose-couch.yaml up -d
docker-compose-couch.yaml包含:
version: '2'
networks:
byfn:
services:
couchdb0:
container_name: couchdb0
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "5984:5984"
networks:
- byfn
peer0.org1.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
depends_on:
- couchdb0
couchdb1:
container_name: couchdb1
image: hyperledger/fabric-couchdb
# Populate the COUCHDB_USER and COUCHDB_PASSWORD to set an admin user and password
# for CouchDB. This will prevent CouchDB from operating in an "Admin Party" mode.
environment:
- COUCHDB_USER=
- COUCHDB_PASSWORD=
# Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
# for example map it to utilize Fauxton User Interface in dev environments.
ports:
- "7984:5984"
networks:
- byfn
peer0.org2.example.com:
environment:
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
# The CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME and CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD
# provide the credentials for ledger to connect to CouchDB. The username and password must
# match the username and password set for the associated CouchDB.
- CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=
- CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=
depends_on:
- couchdb1
有什么想法吗?使用couchdb时有什么原因导致连接错误吗?
谢谢
似乎在与对等点连接时出现了一些问题,因此一旦网络中断,请删除所有容器和卷。然后再次开始网络设置。
这次尝试单独启动 docker 个容器,即首先使用以下命令启动所有其他容器:
docker-compose -f docker-compose-cli.yaml up -d
然后,启动您的 couchdb 容器,因为当 couchdb 启动并尝试搜索对等容器时,您的对等容器可能未启动。所以在所有其他容器都启动之后使用这个:
docker-compose -f docker-compose-couch.yaml up -d
我遇到了同样的问题,我修复了它,在加入频道时增加了一点延迟。
如果脚本在容器启动后立即创建并加入频道,则 couchdb 容器是 运行 而不是其中的数据库。
我的问题已解决,在我的脚本中创建通道之前添加 "sleep 2" 以确保 couchdb 数据库已准备好处理请求。