91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

mac中Hyperledger fabric多通道多節點增刪改查的示例分析

發布時間:2021-12-06 14:20:27 來源:億速云 閱讀:172 作者:小新 欄目:互聯網科技

小編給大家分享一下mac中Hyperledger fabric多通道多節點增刪改查的示例分析,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!

cd /opt/gopath/src/github.com/hyperledger/fabric/aberic

$ docker images

$ docker rmi f0fe49196c40 (IMAGE ID)

$ docker ps -a

$ docker stop $(docker ps -a -q)

$ docker rm $(docker ps -a -q)

=============================================

cd /opt/gopath/src/github.com/hyperledger/fabric/scripts

./bootstrap.sh

首次需要創建(有問題)

./bin/cryptogen generate --config=./crypto-config.yaml

新建channel-artifacts文件夾

export FABRIC_CFG_PATH=$PWD

./bin/configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./channel-artifacts/genesis.block

chmod +x /opt/gopath/src/github.com/hyperledger/fabric/aberic/bin/configtxgen

chmod -R 777 /opt/gopath/src/github.com/hyperledger/fabric/aberic/bin

$ ./bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel.tx -channelID mychannel

新增通道:$ /opt/gopath/src/github.com/hyperledger/fabric/aberic/bin/configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/mychannel2.tx -channelID mychannel2

export CHANNEL_NAME=mychannel

新增通道:export CHANNEL_NAME=mychannel2

$ ./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org1MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org1MSP

$ ./bin/configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate channel-artifacts/Org2MSPanchors.tx -channelID $CHANNEL_NAME -asOrg Org2MSP

修改docker-peer.yaml文件,修改成為紅色部分,/Users/shijun/Desktop/fabricWorkspace/membersheepFabric/crypto-config/peerOrganizations/org1.example.com/ca/4855be3f47ea89f3e86425d6b2bf3fbc5343d187d61887188396405c844077ca_sk

channel-artifacts和crypto-config文件夾打包發給子節點

==============================

主節點執行(子節點不用):$ docker-compose -f docker-orderer.yaml up -d

主節點執行命令:$ docker-compose -f docker-peer.yaml up -d

子節點執行命令:docker-compose -f docker-peer0-org2.yaml up -d

$ docker exec -it cli bash

主節點執行:# peer channel create -o orderer.example.com:7050 -c mychannel  -f ./channel-artifacts/mychannel.tx 

主節點創建新通道:# peer channel create -o orderer.example.com:7050 -c mychannel2  -f ./channel-artifacts/mychannel2.tx 

子節點不用執行上面命令,直接執行:peer channel fetch 0 mychannel.block -o orderer.example.com:7050 -c mychannel

(新通道)子節點不用執行上面命令,直接執行:peer channel fetch 0 mychannel2.block -o orderer.example.com:7050 -c mychannel2

# peer channel join -b mychannel.block

新通道:# peer channel join -b mychannel2.block

新通道不用執行這句話:# peer chaincode install -n traceGoods -p github.com/hyperledger/fabric/aberic/chaincode/go/trace_goods -v 1.0
子節點不執行這句 # peer chaincode instantiate -o orderer.example.com:7050 -C mychannel -n traceGoods -c '{"Args":["init","admin","admin"]}' -P "OR ('Org1MSP.member')" -v 1.0

(新通道)子節點不執行這句 # peer chaincode instantiate -o orderer.example.com:7050 -C mychannel2 -n traceGoods -c '{"Args":["init","admin","admin"]}' -P "OR ('Org1MSP.member')" -v 1.0

# peer chaincode query -C mychannel -n traceGoods -c '{"Args":["queryAllGoods","admin","1","10"]}'

新通道:# peer chaincode query -C mychannel2 -n traceGoods -c '{"Args":["queryAllGoods","admin","1","10"]}'

#peer chaincode invoke -C mychannel -n traceGoods -c '{"Args":["addGoods","94cdaa8576314e6bb4277c11bc3f0492","PS4","2000","2018/12/12","admin"]}'

重啟電腦后啟動fabric,執行以下三條命令

$ docker-compose -f docker-orderer.yaml up -d

$ docker-compose -f docker-peer.yaml up -d

$ docker exec -it cli bash

===============================================

docker-peer0-org2.yaml

# Copyright IBM Corp. All Rights Reserved.
# #
# # SPDX-License-Identifier: Apache-2.0
# #
#
version: '2'

services:

  couchdb:
    container_name: couchdb
    image: hyperledger/fabric-couchdb
    environment:
      - GODEBUG=netdns=go
    # Comment/Uncomment the port mapping if you want to hide/expose the CouchDB service,
    # for example map it to utilize Fauxton User Interface in dev environments.
    ports:
      - "5984:5984"

  ca:
    container_name: ca
    image: hyperledger/fabric-ca
    restart: always
    environment:
      - GODEBUG=netdns=go
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca
      - FABRIC_CA_SERVER_TLS_ENABLED=false
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-config/373d2325b9a13a35b2eebefe5acc0529702f2194e3058bdad0d99b16d092e8ee_sk
    ports:
      - "7054:7054"
    command: sh -c 'fabric-ca-server start --ca.certfile /etc/hyperledger/fabric-ca-server-config/ca.org2.example.com-cert.pem --ca.keyfile /etc/hyperledger/fabric-ca-server-config/373d2325b9a13a35b2eebefe5acc0529702f2194e3058bdad0d99b16d092e8ee_sk -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/org2.example.com/ca/:/etc/hyperledger/fabric-ca-server-config

  peer0.org2.example.com:
    container_name: peer0.org2.example.com
    image: hyperledger/fabric-peer
    restart: always
    environment:
      - GODEBUG=netdns=go
      - CORE_LEDGER_STATE_STATEDATABASE=couchdb
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb:5984

      - CORE_PEER_ID=peer0.org2.example.com
      - CORE_PEER_NETWORKID=aberic
      - CORE_PEER_ADDRESS=peer0.org2.example.com:7051
      - CORE_PEER_CHAINCODELISTENADDRESS=peer0.org2.example.com:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:7051
      - CORE_PEER_LOCALMSPID=Org2MSP

      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      # the following setting starts chaincode containers on the same
      # bridge network as the peers
      # https://docs.docker.com/compose/networking/
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=aberic
      # - CORE_LOGGING_LEVEL=ERROR
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=aberic_default
      - CORE_PEER_GOSSIP_SKIPHANDSHAKE=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=false
      - CORE_PEER_TLS_ENABLED=false
      - CORE_PEER_TLS_CERT_FILE=/etc/hyperledger/fabric/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/etc/hyperledger/fabric/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/etc/hyperledger/fabric/tls/ca.crt
    volumes:
        - /var/run/:/host/var/run/
        - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
        - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    depends_on:
      - couchdb
    networks:
      default:
        aliases:
          - aberic
    extra_hosts:
     - "orderer.example.com:10.85.106.142"
    networks:
      default:
        aliases:
          - aberic

  cli:
    container_name: cli
    image: hyperledger/fabric-tools
    tty: true
    environment:
      - GODEBUG=netdns=go
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=DEBUG
      - CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS=peer0.org2.example.com:7051
      - CORE_PEER_LOCALMSPID=Org2MSP
      - CORE_PEER_TLS_ENABLED=false
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    volumes:
        - /var/run/:/host/var/run/
        - ./chaincode/go/:/opt/gopath/src/github.com/hyperledger/fabric/aberic/chaincode/go
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    depends_on:
      - peer0.org2.example.com
    extra_hosts:
     - "orderer.example.com:10.85.106.142"
     - "peer0.org1.example.com:10.85.106.142"
     - "peer1.org1.example.com:10.85.106.227"
===============================================

docker-orderer.yaml

version: '2'

services:

  orderer.example.com:
    container_name: orderer.example.com
    image: hyperledger/fabric-orderer
    environment:
      - GODEBUG=netdns=go
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=aberic_default
      # - ORDERER_GENERAL_LOGLEVEL=error
      - ORDERER_GENERAL_LOGLEVEL=debug
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=7050
      #- ORDERER_GENERAL_GENESISPROFILE=AntiMothOrdererGenesis
      - ORDERER_GENERAL_GENESISMETHOD=file
      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      #- ORDERER_GENERAL_LEDGERTYPE=ram
      #- ORDERER_GENERAL_LEDGERTYPE=file
      # enabled TLS
      - ORDERER_GENERAL_TLS_ENABLED=false
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer
    volumes:
    - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
    - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
    - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
    networks:
      default:
        aliases:
          - aberic
    ports:
      - 7050:7050
 

看完了這篇文章,相信你對“mac中Hyperledger fabric多通道多節點增刪改查的示例分析”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

临潭县| 确山县| 湘潭县| 新野县| 阿城市| 徐汇区| 镇沅| 华容县| 金山区| 阿克陶县| 湖州市| 玉田县| 来宾市| 报价| 饶平县| 樟树市| 吴忠市| 宿州市| 巫山县| 油尖旺区| 宣汉县| 福贡县| 贡山| 塔城市| 根河市| 乡宁县| 临猗县| 娱乐| 崇信县| 江津市| 沙坪坝区| 龙口市| 肥乡县| 都江堰市| 东台市| 兴和县| 年辖:市辖区| 汾阳市| 凌云县| 白沙| 洞头县|