Tools, FAQ, Tutorials:
Impact of Stopping Chaincode Container
What is the impact of stopping a chaincode container of a peer?
✍: FYIcenter.com
We know that if a Peer has chaincode installed, it will run it as
chaincode container to help the channel to perform a transaction
on the chaincode.
If you stop a chaincode container of a peer who is not a required member of the chaincode, the chaincode will continue to work.
Let's use the BYFN network as an example to find out the impact of stopping a chaincode container of a peer.
1. List all running chaincode containers:
$ docker ps | grep chaincode CONTAINER ID STATUS NAMES f729e3534a17 Up 14 hours dev-peer1.org2.example.com-mycc-1.0 9b93813390d3 Up 14 hours dev-peer0.org1.example.com-mycc-1.0 4e1b1b131dc5 Up 14 hours dev-peer0.org2.example.com-mycc-1.0
This matches well with what we learned on the CLI container. All 4 peers are members of "mychannel", but only 3 peers have "mycc" chaincode installed and running.
2. Stop the chaincode container for peer1.org2:
$ docker stop f729e3534a17
3. Check the chaincode status on peer1.org2. No changes.
$ docker exec -it cli bash bash-4.4# source peer1-org2.sh bash-4.4# peer chaincode list --installed Get installed chaincodes on peer: Name: mycc, Version: 1.0, Path: github.com/chaincode/chaincode_example02/... bash-4.4# peer chaincode list -C mychannel --instantiated Get instantiated chaincodes on channel mychannel:
4. Submit a transaction on peer0.org1:
bash-4.4# source peer0-org1.sh bash-4.4# peer chaincode invoke -o orderer.example.com:7050 --tls true \ --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto\ /ordererOrganizations/example.com/orderers/orderer.example.com/msp\ /tlscacerts/tlsca.example.com-cert.pem -C mychannel -n mycc \ --peerAddresses peer0.org1.example.com:9051 --tlsRootCertFiles \ /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations\ /org1.example.com/peers/peer0.org1.example.com/tls/ca.crt \ --peerAddresses peer0.org2.example.com:9051 --tlsRootCertFiles \ /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations\ /org2.example.com/peers/peer0.org2.example.com/tls/ca.crt \ -c '{"Args":["invoke","a","b","10"]}' [chaincodeCmd] chaincodeInvokeOrQuery -> INFO 001 Chaincode invoke successful. result: status:200 bash-4.4# peer chaincode query -C mychannel -n mycc -c '{"Args":["query","a"]}' 80
5. Verify that the status chaincode container for peer1.org2 is still stopped.
bash-4.4# exit $ docker ps | grep chaincode CONTAINER ID STATUS NAMES 9b93813390d3 Up 14 hours dev-peer0.org1.example.com-mycc-1.0 4e1b1b131dc5 Up 14 hours dev-peer0.org2.example.com-mycc-1.0
The logical chaincode instance "mycc" on the channel is still working without the chaincode container for peer1.org2, because peer1.org2 is not a required peer for the chaincode.
Â
⇒ Auto-Start of Required Chaincode Container
⇠Not All Member Peers Run Chaincode
⇑ Hyperledger Fabric Docker Containers
⇑⇑ Hyperledger Tutorials
2019-04-17, 878👍, 0💬
Popular Posts:
Where to find tutorials on PHP language? I want to know how to learn PHP. Here is a large collection...
How to use the Atom Online Validator at w3.org? w3.org feed validation service is provided at http:/...
What is Azure API Management Developer Portal Admin? The Developer Portal Admin is an Azure Web port...
How to extend json.JSONEncoder class? I want to encode other Python data types to JSON. If you encod...
Where to find tutorials on how to create Your Own Functions in PHP? A collection of tutorials to ans...