多个对等节点,但只有一个开发对等节点
Multiple peer nodes but only one dev-peer
我有一个 Fabric Composer 网络,在一个组织中有 3 个同行。
问题是当我这样做时 docker stats
我只看到一个 'Chain code container' dev-peer0.org1 并且据我所知应该有每个对等节点的 dev-peer ()
这是我的连接配置文件
{
"name": "hlfv1",
"x-type": "hlfv1",
"x-commitTimeout": 300,
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300",
"eventHub": "300",
"eventReg": "300"
},
"orderer": "300"
}
}
},
"channels": {
"composerchannel": {
"orderers": [
"orderer.example.com"
],
"peers": {
"peer0.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer1.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer2.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com",
"peer1.org1.example.com",
"peer2.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
}
},
"orderers": {
"orderer.example.com": {
"url": "grpc://localhost:7050"
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpc://localhost:7051"
},
"peer1.org1.example.com": {
"url": "grpc://localhost:8051"
},
"peer2.org1.example.com": {
"url": "grpc://localhost:9051"
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "http://localhost:7054",
"caName": "ca.org1.example.com"
}
}
}
有人知道哪里出了问题吗?
当节点安装链代码并实例化链代码时,会自动生成开发节点容器。
这意味着只有您网络中的 peer0.org1 安装了链代码。
你可以看看Byfn项目的解释here
知道了。问题是我没有更改 startFabric.sh
脚本所以我有 3 个对等节点 运行 但他们没有加入频道
startFabric.sh
应该是这样的:
...
# Create the channel and join for peer 0
docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
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
# Create the channel and join for peer 1
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
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer1.org1.example.com peer channel join -b composerchannel_config.block
# Create the channel and join for peer 2
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel fetch config -o orderer.example.com:7050 -c composerchannel
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel join -b composerchannel_config.block
if [ "${FABRIC_DEV_MODE}" == "true" ]; then
echo "Fabric Network started in chaincode development mode"
fi
仅当您在通道上实例化链码时才会创建容器。仅安装链码不会创建容器。
有关此过程的更多详细信息,请参阅下面提到的官方文档。(搜索文本 "dev-peer")。
本文档解释了如何为 byfn 示例创建每个链代码容器。
https://github.com/hyperledger/fabric/blob/release-1.4/docs/source/build_network.rst
例如:[for dev-peer0.org2.example.com-mycc-1.0]
- The chaincode is then "instantiated" on ``mychannel``. Instantiation
adds the chaincode to the channel, starts the container for the target peer,
and initializes the key value pairs associated with the chaincode. The initial
values for this example are ["a","100" "b","200"]. **This "instantiation" results
in a container by the name of ``dev-peer0.org2.example.com-mycc-1.0`` starting.**
我有一个 Fabric Composer 网络,在一个组织中有 3 个同行。
问题是当我这样做时 docker stats
我只看到一个 'Chain code container' dev-peer0.org1 并且据我所知应该有每个对等节点的 dev-peer (
这是我的连接配置文件
{
"name": "hlfv1",
"x-type": "hlfv1",
"x-commitTimeout": 300,
"version": "1.0.0",
"client": {
"organization": "Org1",
"connection": {
"timeout": {
"peer": {
"endorser": "300",
"eventHub": "300",
"eventReg": "300"
},
"orderer": "300"
}
}
},
"channels": {
"composerchannel": {
"orderers": [
"orderer.example.com"
],
"peers": {
"peer0.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer1.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
},
"peer2.org1.example.com": {
"endorsingPeer": true,
"chaincodeQuery": true,
"eventSource": true
}
}
}
},
"organizations": {
"Org1": {
"mspid": "Org1MSP",
"peers": [
"peer0.org1.example.com",
"peer1.org1.example.com",
"peer2.org1.example.com"
],
"certificateAuthorities": [
"ca.org1.example.com"
]
}
},
"orderers": {
"orderer.example.com": {
"url": "grpc://localhost:7050"
}
},
"peers": {
"peer0.org1.example.com": {
"url": "grpc://localhost:7051"
},
"peer1.org1.example.com": {
"url": "grpc://localhost:8051"
},
"peer2.org1.example.com": {
"url": "grpc://localhost:9051"
}
},
"certificateAuthorities": {
"ca.org1.example.com": {
"url": "http://localhost:7054",
"caName": "ca.org1.example.com"
}
}
}
有人知道哪里出了问题吗?
当节点安装链代码并实例化链代码时,会自动生成开发节点容器。
这意味着只有您网络中的 peer0.org1 安装了链代码。
你可以看看Byfn项目的解释here
知道了。问题是我没有更改 startFabric.sh
脚本所以我有 3 个对等节点 运行 但他们没有加入频道
startFabric.sh
应该是这样的:
...
# Create the channel and join for peer 0
docker exec peer0.org1.example.com peer channel create -o orderer.example.com:7050 -c composerchannel -f /etc/hyperledger/configtx/composer-channel.tx
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
# Create the channel and join for peer 1
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
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer1.org1.example.com peer channel join -b composerchannel_config.block
# Create the channel and join for peer 2
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel fetch config -o orderer.example.com:7050 -c composerchannel
docker exec -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/Admin@org1.example.com/msp" peer2.org1.example.com peer channel join -b composerchannel_config.block
if [ "${FABRIC_DEV_MODE}" == "true" ]; then
echo "Fabric Network started in chaincode development mode"
fi
仅当您在通道上实例化链码时才会创建容器。仅安装链码不会创建容器。
有关此过程的更多详细信息,请参阅下面提到的官方文档。(搜索文本 "dev-peer")。
本文档解释了如何为 byfn 示例创建每个链代码容器。
https://github.com/hyperledger/fabric/blob/release-1.4/docs/source/build_network.rst
例如:[for dev-peer0.org2.example.com-mycc-1.0]
- The chaincode is then "instantiated" on ``mychannel``. Instantiation
adds the chaincode to the channel, starts the container for the target peer,
and initializes the key value pairs associated with the chaincode. The initial
values for this example are ["a","100" "b","200"]. **This "instantiation" results
in a container by the name of ``dev-peer0.org2.example.com-mycc-1.0`` starting.**