我的hyperledger作曲家网络设置如下:
所有同行都订阅了一个公共频道(composerchannel)。我在主网站的教程部分创建了一个示例应用程序(教程网络),并将其安装在网络上。
当我浏览couchdb1时,我可以看到一个名为" composerchannel_tutorial-network"为我导入的应用程序。我通过REST界面添加了几个参与者,它们也出现在couchdb1中。
问题是,当我查看couchdb2和couchdb3实例时,我看不到数据库" composerchannel_tutorial-network"在他们。我相信,因为所有这些对等体都订阅了单个通道,所以它应该自动在所有对等体上复制该数据库。
我在Peer2泊坞窗日志中看到以下错误
unable to get chaincode data from ledger for tx due to lscc's state for [tutorial-network] not found
我在Peer3泊坞窗日志(外部系统)中看到以下错误
error getting chaincode tutorial-network on channel: composerchannel (err: could not find chaincode with name 'tutorial-network')
看到Peer1容器日志
我认为"作曲家网络安装"和#34;作曲家网络开始"应该处理订阅频道的网络上的所有同伴。
我更新了./startFabric.sh,以便Peer1加入频道" composerchannel"。以下命令均未显示任何错误。
以下是我遵循的步骤:
./startFabric.sh
./createPeerAdminCard.sh
composer network install --card PeerAdmin@hlfv1 --archiveFile tutorial-network@0.0.1.bna
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file networkadmin.card
composer card import --file networkadmin.card
composer network ping --card admin@tutorial-network
composer-rest-server
有人可以告知可能出现的问题吗?
答案 0 :(得分:1)
Chaincode需要安装在所有认可的同行上。 Composer网络安装将在您组织中所有支持对等方安装链代码,并且是连接配置文件定义的通道的一部分。因此,如果您有多个组织,则需要为每个组织执行安装。 我还要检查对等日志,确定每个对等体的右侧couchdb的通信,并检查当您将每个对等体加入该通道时,您获得成功的消息。
这是我的docker-compose文件,用于同一个组织中的2个对等体,以及它们自己的couchdb实例。我可以看到两个couchdb实例都在创建和使用日志中的数据
version: '2'
services:
ca.org1.example.com:
image: hyperledger/fabric-ca:$ARCH-1.1.0
environment:
- FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
- FABRIC_CA_SERVER_CA_NAME=ca.org1.example.com
ports:
- "7054:7054"
command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org1.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/19ab65abbb04807dad12e4c0a9aaa6649e70868e3abd0217a322d89e47e1a6ae_sk -b admin:adminpw -d'
volumes:
- ./crypto-config/peerOrganizations/org1.example.com/ca/:/etc/hyperledger/fabric-ca-server-config
container_name: ca.org1.example.com
orderer.example.com:
container_name: orderer.example.com
image: hyperledger/fabric-orderer:$ARCH-1.1.0
environment:
- ORDERER_GENERAL_LOGLEVEL=debug
- ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
- ORDERER_GENERAL_GENESISMETHOD=file
- ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/composer-genesis.block
- ORDERER_GENERAL_LOCALMSPID=OrdererMSP
- ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/msp/orderer/msp
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: orderer
ports:
- 7050:7050
volumes:
- ./:/etc/hyperledger/configtx
- ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/etc/hyperledger/msp/orderer/msp
peer0.org1.example.com:
container_name: peer0.org1.example.com
image: hyperledger/fabric-peer:$ARCH-1.1.0
environment:
- CORE_LOGGING_LEVEL=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer0.org1.example.com
- CORE_PEER_ADDRESS=peer0.org1.example.com:7051
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=composer_default
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/msp
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
ports:
- 7051:7051
- 7053:7053
volumes:
- /var/run/:/host/var/run/
- ./:/etc/hyperledger/configtx
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/peer/msp
- ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
depends_on:
- orderer.example.com
- couchdb
couchdb:
container_name: couchdb
image: hyperledger/fabric-couchdb:$ARCH-0.4.6
ports:
- 5984:5984
environment:
DB_URL: http://localhost:5984/member_db
peer1.org1.example.com:
container_name: peer1.org1.example.com
image: hyperledger/fabric-peer:$ARCH-1.1.0
environment:
- CORE_LOGGING_LEVEL=debug
- CORE_CHAINCODE_LOGGING_LEVEL=DEBUG
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_PEER_ID=peer1.org1.example.com
- CORE_PEER_ADDRESS=peer1.org1.example.com:7051
- CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=composer_default
- CORE_PEER_LOCALMSPID=Org1MSP
- CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/peer/msp
- CORE_LEDGER_STATE_STATEDATABASE=CouchDB
- CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
working_dir: /opt/gopath/src/github.com/hyperledger/fabric
command: peer node start
ports:
- 8051:7051
- 8053:7053
volumes:
- /var/run/:/host/var/run/
- ./:/etc/hyperledger/configtx
- ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/peer/msp
- ./crypto-config/peerOrganizations/org1.example.com/users:/etc/hyperledger/msp/users
depends_on:
- orderer.example.com
- couchdb2
couchdb2:
container_name: couchdb2
image: hyperledger/fabric-couchdb:$ARCH-0.4.6
ports:
- 6984:5984
environment:
DB_URL: http://localhost:5984/member_db
startFabric.sh
#!/bin/bash
# Exit on first error, print all commands.
set -e
Usage() {
echo ""
echo "Usage: ./startFabric.sh [-d || --dev]"
echo ""
echo "Options:"
echo -e "\t-d or --dev: (Optional) enable fabric development mode"
echo ""
echo "Example: ./startFabric.sh"
echo ""
exit 1
}
Parse_Arguments() {
while [ $# -gt 0 ]; do
case $1 in
--help)
HELPINFO=true
;;
--dev | -d)
FABRIC_DEV_MODE=true
;;
esac
shift
done
}
Parse_Arguments $@
if [ "${HELPINFO}" == "true" ]; then
Usage
fi
#Detect architecture
ARCH=`uname -m`
# Grab the current directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "${FABRIC_DEV_MODE}" == "true" ]; then
DOCKER_FILE="${DIR}"/composer/docker-compose-dev.yml
else
DOCKER_FILE="${DIR}"/composer/docker-compose.yml
fi
ARCH=$ARCH docker-compose -f "${DOCKER_FILE}" down
ARCH=$ARCH docker-compose -f "${DOCKER_FILE}" up -d
# wait for Hyperledger Fabric to start
# incase of errors when running later commands, issue export FABRIC_START_TIMEOUT=
echo "sleeping for ${FABRIC_START_TIMEOUT} seconds to wait for fabric to complete start up"
sleep ${FABRIC_START_TIMEOUT}
# Create the channel
docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
# Join peer0.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer0.org1.example.com peer channel join -b composerchannel.block
echo fetching block
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer1.org1.example.com peer channel fetch config -o orderer.example.com:7050 -c composerchannel composerchannel.block
echo joining peer1
# Join peer1.org1.example.com to the channel.
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer1.org1.example.com peer channel join -b composerchannel.block
if [ "${FABRIC_DEV_MODE}" == "true" ]; then
echo "Fabric Network started in chaincode development mode"
fi
答案 1 :(得分:0)
我认为这是非常愚蠢的错误!我的附加同行的面料版本1.0.4和我的第一个同行它是1.1.0。将Peer2结构版本更新为1.1.0使它像魅力一样工作!!
感谢@david_k获取所有答案和指导!真的很感激。