Tools, FAQ, Tutorials:
Switch Default Peer with Scripts
How to Switch Default Peer on the CLI container with Scripts? I am tired of typing those 4 CORE_PEER_* export commands.
✍: FYIcenter.com
From previous tutorial, we know that we need to type in export commands
to set 4 CORE_PEER_* environment variables.
But you can also put them into shell scripts and run them whenever needed.
1. Connect to the CLI container:
$ docker exec -it cli bash bash-4.4#
2. Create a script file for peer0.org1:
bash-4.4# vi peer0-org1.sh export CORE_PEER_ADDRESS=peer0.org1.example.com:7051 export CORE_PEER_LOCALMSPID=Org1MSP export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger\ /fabric/peer/crypto/peerOrganizations/org1.example.com/users\ /Admin@org2.example.com/msp export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger\ /fabric/peer/crypto/peerOrganizations/org1.example.com/peers\ /peer0.org1.example.com/tls/ca.crt bash-4.4# chmod 711 peer0-org1.sh
3. Create script files for peer1.org1, peer0.org2, and peer1.org2 in the same as step 2.
4. Run a script file with "source" command and test it:
bash-4.4# source peer1-org2.sh bash-4.4# echo $CORE_PEER_ADDRESS peer1.org2.example.com:7051 bash-4.4# peer node status status:STARTED
Â
⇠CouchDB Server Admin Web Portal
⇑ Hyperledger Fabric Docker Containers
⇑⇑ Hyperledger Tutorials
2020-05-29, 820👍, 0💬
Popular Posts:
Where to find tutorials on Visual Studio? I want to know How to learn Visual Studio. Here is a large...
How to dump (or encode, serialize) a Python object into a JSON string using json.dumps()? The json.d...
Where to find tutorials on Using Azure API Management Developer Portal? Here is a list of tutorials ...
How to troubleshoot the Orderer peer? The Docker container terminated by itself. You can follow this...
Where to get a JSON.stringify() Example Code in JavaScript? Here is a good JSON.stringify() example ...