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
2019-04-17, 1060🔥, 0💬
Popular Posts:
What is EPUB 2.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 2.0 Metadata "dc:publisher" ...
How to use "{{...}}" Liquid Codes in "set-body" Policy Statement? The "{{...}}" Liquid Codes in "set...
How to use the "send-request" Policy statement to call an extra web service for an Azure API service...
How to detect errors occurred in the json_decode() call? You can use the following two functions to ...
How To Pad an Array with the Same Value Multiple Times in PHP? If you want to add the same value mul...