fabric 1.4.3 멀티컴퓨터 다중 노드 배치 (1)

6605 단어 블록체인

fabric 1.4.3 멀티 컴퓨터 멀티 노드 배포:


(1) 프로젝트 환경 멀티컴퓨터 멀티노드는 여러 대의 컴퓨터에 여러 개의 조직과 노드를 배치하는 것을 가리킨다. 본 사례는 하나의 정렬(orderer) 서비스, 두 개의 조직(org1,org2)과 네 개의 노드(peer)를 배치하는데 각 조직은 두 개의 노드를 포함하고 세 개의 서버가 필요하다. 계획은 다음과 같다.
orderer.example.com 101.201.253.208
peer0.org1.example.com 123.56.48.16
peer1.org1.example.com 123.56.48.16
peer0.org2.example.com 39.96.115.136
peer1.org2.example.com 39.96.115.136
본고는orderer 노드를 예로 들면 먼저 101.201.253.208 서버에서 조작한다.세 대의 서버가 동시에 기초fabric 환경을 설치합니다: ~/hy/fabric-samples 디렉터리에 있습니다.1. 작업 디렉토리 만들기 및 진입
cd ~/hy/fabric-samples mkdir test && cd test
2. crypto-config를 구성합니다.yaml, 명령으로 인증서 생성
vim crypto-config.yaml
OrdererOrgs:
  • Name: Orderer Domain: example.com Specs:
  • Hostname: orderer PeerOrgs:

  • Name: Org1 Domain: org1.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1
  • Name: Org2 Domain: org2.example.com EnableNodeOUs: true Template: Count: 2 Users: Count: 1

  • $ cryptogen generate --config=./crypto-config.yaml
    (여기cryptogen 도구 오류가 발생하면 환경 변수를 설정하거나 bin을test 디렉터리에 복사해야 합니다.)confiltx를 설정합니다.yaml, 창세 블록과 채널 파일 생성
    vim configtx.yaml
    Organizations:
    - &OrdererOrg
        Name: OrdererOrg
        ID: OrdererMSP
        MSPDir: crypto-config/ordererOrganizations/example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"
    
      - &Org1
        Name: Org1MSP
        ID: Org1MSP
        MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org1MSP.admin')"
        AnchorPeers:
            - Host: peer0.org1.example.com
              Port: 7051
    
     - &Org2
        Name: Org2MSP
        ID: Org2MSP
        MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org2MSP.admin')"
    
        AnchorPeers:
            - Host: peer0.org2.example.com
              Port: 7051      
    Capabilities:               
       Global: &ChannelCapabilities
          V1_1: true
       Orderer: &OrdererCapabilities
          V1_1: true
      Application: &ApplicationCapabilities
          V1_2: true   
    Application: &ApplicationDefaults
      Organizations:
      Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
    Capabilities:
        <<: orderer:="" orderertype:="" solo="" addresses:="" orderer.example.com:7050="" batchtimeout:="" batchsize:="" maxmessagecount:="" absolutemaxbytes:="" mb="" preferredmaxbytes:="" kb="" kafka:="" brokers:="" organizations:="" policies:="" readers:="" type:="" implicitmeta="" rule:="" readers="" writers:="" writers="" admins:="" admins="" blockvalidation:="" capabilities:="" channel:="" profiles:="" twoorgsorderergenesis:="" consortiums:="" sampleconsortium:="" twoorgschannel:="" consortium:="" sampleconsortium="" application:=""/>

    mkdir ./channel-artifacts configtxgen -profile TwoOrgsOrdererGenesis -channelID testchannel -outputBlock ./channel-artifacts/genesis.block configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID testchannel
    4. 앵커 노드 구성 파일 생성
    configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/Org2MSPanchors.tx -channelID mychannel -asOrg Org2MSP
    5. docker-compose-order를 설정합니다.yaml 파일 아래에서 docker-compose로 통일하기 위해 이름을 바꿉니다.yaml 파일
    vim docker-compose.yaml
    version: ‘2’ networks: byfn: services: orderer.example.com: container_name: orderer.example.com image: hyperledger/fabric-orderer environment: - GODEBUG=netdns=go - FABRIC_LOGGING_SPEC=INFO - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0 - ORDERER_GENERAL_GENESISMETHOD=file - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block - ORDERER_GENERAL_LOCALMSPID=OrdererMSP - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp # enabled TLS - ORDERER_GENERAL_TLS_ENABLED=true - 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] - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1 - ORDERER_KAFKA_VERBOSE=true 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 ports: - 7050:7050 networks: - byfn extra_hosts: - “peer0.org1.example.com:123.56.48.16” - “peer1.org1.example.com:123.56.48.16” - “peer0.org2.example.com:39.96.115.136” - “peer1.org2.example.com:39.96.115.136”
    6. Fabric 네트워크 시작
    docker-compose -f docker-compose.yaml up
    7. 터미널을 따로 열어 용기 상태를 확인한다
    docker ps
    8.order 노드가 시작되면 다른 컴퓨터로 파일을 복사하여 생성합니다
    cd ~/hy/fabric-samples scp -r test [email protected]:/root/hy/fabric-samples/scp -r test [email protected]:/root/hy/fabric-samples/

    여기까지oderer 노드 설정 완료.

    좋은 웹페이지 즐겨찾기