Hyperledger Fabric 1.0実戦(三)試運転
4414 ワード
『Hyperledger Fabric 1.0実戦(一)環境準備』に続く:https://www.jianshu.com/p/12d8d82305da
一定の準備ができたら、Fabricオープンソースのミラーとソースコードを引いて試運転することができます.
1.gitソースコードを引く
2.fabricに必要なミラーを引き出す
3.cryptogen、configtxgenなどのツールのコンパイル
4. e2e_cli単機運転テスト
5.fabric-samplesより多くの試運転
次はマルチマシン配備:『Hyperledger Fabric 1.0実戦(四)マルチマシン配備e 2 e_cli』https://www.jianshu.com/p/4a12ef59a489
一定の準備ができたら、Fabricオープンソースのミラーとソースコードを引いて試運転することができます.
1.gitソースコードを引く
a. Fabric
mkdir -p /opt/gopath/src/github.com/hyperledger
b. hyperledger
cd /opt/gopath/src/github.com/hyperledger
c. fabric v1.0.0
git clone -b v1.0.0 https://github.com/hyperledger/fabric.git
2.fabricに必要なミラーを引き出す
:
./fabric/examples/e2e_cli/ , 。( , )
# nohup ./download-dockerimages.sh &
nohup.out ;
, :
a. DockerHub :
https://hub.docker.com/u/hyperledger/?page=1
b. , :
docker pull hyperledger/fabric-tools:x86_64-1.0.0
docker pull hyperledger/fabric-couchdb:x86_64-1.0.0
docker pull hyperledger/fabric-kafka:x86_64-1.0.0
docker pull hyperledger/fabric-zookeeper:x86_64-1.0.0
docker pull hyperledger/fabric-orderer:x86_64-1.0.0
docker pull hyperledger/fabric-javaenv:x86_64-1.0.0
docker pull hyperledger/fabric-ccenv:x86_64-1.0.0
docker pull hyperledger/fabric-ca:x86_64-1.0.0
docker pull hyperledger/fabric-baseos:x86_64-0.3.1
docker pull hyperledger/fabric-baseimage:x86_64-0.3.1
docker pull hyperledger/fabric-membersrvc:latest
c. , :
docker images
d. docker-compose , tag latest,
docker tag IMAGEID( id) REPOSITORY:TAG( : )
docker tag 0403fd1c72c7 docker.io/hyperledger/fabric-tools:latest
e.
1.
docker save 6830dcd7b9b5> /tmp/docker/fabric-images/peer.tar
2.
docker load < /tmp/docker/fabric-peer.tar
, , tag lastest。
docker images
3.cryptogen、configtxgenなどのツールのコンパイル
1. fabric
# cd opt/gopath/src/github.com/hyperledger/fabric/
2. release
# make release
4. e2e_cli単機運転テスト
1. e2e_cli
# cd opt/gopath/src/github.com/hyperledger/fabric/examples/e2e_cli
2.
# ./network_setup.sh up
:
……
Query Result: 90
2018-04-24 08:49:35.836 UTC [main] main -> INFO 007 Exiting.....
===================== Query on PEER3 on channel 'mychannel' is successful =====================
===================== All GOOD, End-2-End execution completed =====================
_____ _ _ ____ _____ ____ _____
| ____| | \ | | | _ \ | ____| |___ \ | ____|
| _| | \| | | | | | _____ | _| __) | | _|
| |___ | |\ | | |_| | |_____| | |___ / __/ | |___
|_____| |_| \_| |____/ |_____| |_____| |_____|
;
3. fabric e2e_cli
# ./network_setup.sh down
5.fabric-samplesより多くの試運転
git clone https://github.com/hyperledger/fabrci-samples.git
cd fabric-samples/basic-network
docker-compose f docker-compose.yml up -d
result:
Creating orderer.example.com ... done
Creating peer0.org1.example.com ... done
Creating couchdb ...
Creating orderer.example.com ...
Creating cli ...
Creating peer0.org1.example.com ...
#docker ps ---> for check
# , peer peer0.org1.example.com
docker exec -it -e "CORE_PEER_MSPCONFIGPATH=/etc/hyperledger/msp/users/[email protected]/msp" peer0.org1.example.com bash
#
peer channel create -o orderer.example.com:7050 -c mychannel -f /etc/hyperledger/configtx/channel.tx
#
peer channel join -b mychannel.block
# peer peer0.org1.example.com
exit
# cli
docker exec -it cli /bin/bash
# peer peer0.org1.example.com ( ), go/node
peer chaincode install -n mycc -v v0 -p github.com/chaincode_example02/go/
#
peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n mycc -v v0 -c '{"Args":["init","a","100","b","200"]}'
#
peer chaincode query -C mychannel -n mycc -v v0 -c '{"Args":["query","a"]}'
次はマルチマシン配備:『Hyperledger Fabric 1.0実戦(四)マルチマシン配備e 2 e_cli』https://www.jianshu.com/p/4a12ef59a489