美文网首页
Fabric1.4.6多机多节点搭建(etcdraft)

Fabric1.4.6多机多节点搭建(etcdraft)

作者: Li_MAX | 来源:发表于2020-06-03 09:10 被阅读0次

文件已上传:https://github.com/lgy1027/fabric-network

原本是win下生成证书创世快,cp到linux服务器启动节点报警告,后来换成linux下生成证书创世快,解决问题,对比下1.2.0版本,可能是升级区分平台了吧。


fix.png

整体目录:


image.png

节点分布


image.png

crypto-config.yaml

OrdererOrgs:
  - Name: Orderer
    Domain: lgy.com
    EnableNodeOUs: true
    Specs:
      - Hostname: orderer1
      - Hostname: orderer2
      - Hostname: orderer3
#      - Hostname: orderer4
#      - Hostname: orderer5
PeerOrgs:
  - Name: Org1
    Domain: org1.lgy.com
    EnableNodeOUs: true
    Template:
      Count: 2
    Users:
      Count: 1
  - Name: Org2
    Domain: org2.lgy.com
    EnableNodeOUs: true
    Template:
      Count: 2
    Users:
      Count: 1

configtx.yaml

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
---
Organizations:

    - &OrdererOrg
        Name: OrdererOrg

        ID: OrdererMSP

        MSPDir: crypto-config/ordererOrganizations/lgy.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.lgy.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.lgy.com
              Port: 8051

    - &Org2

        Name: Org2MSP

        ID: Org2MSP

        MSPDir: crypto-config/peerOrganizations/org2.lgy.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.lgy.com
              Port: 8051

Capabilities:
    Channel: &ChannelCapabilities
        V1_4_3: true
        V1_3: false
        V1_1: false
    Orderer: &OrdererCapabilities
        V1_4_2: true
        V1_1: false

    Application: &ApplicationCapabilities
        V1_4_2: true
        V1_3: false
        V1_2: false
        V1_1: false

Application: &ApplicationDefaults

    Organizations:
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ApplicationCapabilities

Orderer: &OrdererDefaults

    OrdererType: solo

    Addresses:
        - orderer.lgy.com:7050

    BatchTimeout: 2s

    BatchSize:

        MaxMessageCount: 10

        AbsoluteMaxBytes: 99 MB

        PreferredMaxBytes: 512 KB

    Kafka:
        Brokers:
            - 127.0.0.1:9092

    EtcdRaft:
        Consenters:
            - Host: orderer1.lgy.com
              Port: 8050
              ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer1.lgy.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer1.lgy.com/tls/server.crt
            - Host: orderer2.lgy.com
              Port: 8050
              ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer2.lgy.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer2.lgy.com/tls/server.crt
            - Host: orderer3.lgy.com
              Port: 8050
              ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer3.lgy.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer3.lgy.com/tls/server.crt
#            - Host: orderer4.lgy.com
#              Port: 8050
#              ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer4.lgy.com/tls/server.crt
#              ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer4.lgy.com/tls/server.crt
#            - Host: orderer5.lgy.com
#              Port: 8050
#              ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer5.lgy.com/tls/server.crt
#              ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer5.lgy.com/tls/server.crt

    Organizations:
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

Channel: &ChannelDefaults
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ChannelCapabilities

Profiles:

    TwoOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    TwoOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

    SampleDevModeKafka:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            OrdererType: kafka
            Kafka:
                Brokers:
                - kafka.lgy.com:9092

            Organizations:
            - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Application:
            <<: *ApplicationDefaults
            Organizations:
            - <<: *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                - *Org1
                - *Org2

    SampleMultiNodeEtcdRaft:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            OrdererType: etcdraft
            EtcdRaft:
                Consenters:
                - Host: orderer1.lgy.com
                  Port: 8050
                  ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer1.lgy.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer1.lgy.com/tls/server.crt
                - Host: orderer2.lgy.com
                  Port: 8050
                  ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer2.lgy.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer2.lgy.com/tls/server.crt
                - Host: orderer3.lgy.com
                  Port: 8050
                  ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer3.lgy.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer3.lgy.com/tls/server.crt
#                - Host: orderer4.lgy.com
#                  Port: 7050
#                  ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer4.lgy.com/tls/server.crt
#                  ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer4.lgy.com/tls/server.crt
#                - Host: orderer5.lgy.com
#                  Port: 7050
#                  ClientTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer5.lgy.com/tls/server.crt
#                  ServerTLSCert: crypto-config/ordererOrganizations/lgy.com/orderers/orderer5.lgy.com/tls/server.crt
            Addresses:
                - orderer1.lgy.com:8050
                - orderer2.lgy.com:8050
                - orderer3.lgy.com:8050
#                - orderer4.lgy.com:7050
#                - orderer5.lgy.com:7050

            Organizations:
            - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Application:
            <<: *ApplicationDefaults
            Organizations:
            - <<: *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                - *Org1
                - *Org2

证书生成

//生成证书、通道配置文件、创世块
cryptogen generate --config=./crypto-config.yaml
mkdir channel-artifacts

configtxgen -profile SampleMultiNodeEtcdRaft -outputBlock ./channel-artifacts/genesis.block

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

Order

base.yaml

version: '2'

services:
  # 多机网络域名对应ip
  rafthosts:
    image: busybox
    volumes:
      - /etc/localtime:/etc/localtime
    environment:
      - COLUMNS=500
      - GODEBUG=netdns=go
    extra_hosts:
      - "orderer1.lgy.com:192.168.1.11"
      - "orderer2.lgy.com:192.168.1.8"
      - "orderer3.lgy.com:192.168.1.9"
      - "peer0.org1.lgy.com:192.168.1.8"
      - "peer1.org1.lgy.com:192.168.1.9"
      - "peer0.org2.lgy.com:192.168.1.10"
      - "peer1.org2.lgy.com:192.168.1.11"

order1.yaml

version: '2'

services:
  orderer1.lgy.com:
    container_name: orderer1.lgy.com
    image: hyperledger/fabric-orderer
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - 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
      - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_CLUSTER_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/lgy.com/orderers/orderer1.lgy.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/lgy.com/orderers/orderer1.lgy.com/tls:/var/hyperledger/orderer/tls
    ports:
      - 8050:7050

order2.yaml

version: '2'

services:
  orderer1.lgy.com:
    container_name: orderer1.lgy.com
    image: hyperledger/fabric-orderer
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - 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
      - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_CLUSTER_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/lgy.com/orderers/orderer2.lgy.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/lgy.com/orderers/orderer2.lgy.com/tls:/var/hyperledger/orderer/tls
    ports:
      - 8050:7050

order3.yaml

version: '2'

services:
  orderer2.lgy.com:
    container_name: orderer2.lgy.com
    image: hyperledger/fabric-orderer
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - 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
      - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_CLUSTER_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/lgy.com/orderers/orderer3.lgy.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/lgy.com/orderers/orderer3.lgy.com/tls:/var/hyperledger/orderer/tls
    ports:
      - 8050:7050

Peer

peer0org1.yaml

version: '2'

services:
  couchdb0:
    image: hyperledger/fabric-couchdb
    container_name: couchdb0
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=123456
    ports:
      - 5984:5984

  peer0.org1.lgy.com:
    image: hyperledger/fabric-peer:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    container_name: peer0.org1.lgy.com
    environment:
      - CORE_PEER_ID=peer0.org1.lgy.com
      - CORE_PEER_ADDRESS=peer0.org1.lgy.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org1.lgy.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.lgy.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.lgy.com:8051
      - CORE_PEER_GOSSIP_ENDPOINT=peer0.org1.lgy.com:8051
      -
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft_clustor_default
      - FABRIC_LOGGING_SPEC=INFO
      #- FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - 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
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb0:5984
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456
    depends_on:
      - couchdb0
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.lgy.com/peers/peer0.org1.lgy.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org1.lgy.com/peers/peer0.org1.lgy.com/tls:/etc/hyperledger/fabric/tls
    ports:
      - 8051:7051
      - 8052:7052
      - 8053:7053


  cli0:
    container_name: cli0
    image: hyperledger/fabric-tools:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    tty: true
    stdin_open: true
    environment:
      #- SYS_CHANNEL=$SYS_CHANNEL
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli0
      - CORE_PEER_ADDRESS=peer0.org1.lgy.com:8051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer0.org1.lgy.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer0.org1.lgy.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer0.org1.lgy.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/users/Admin@org1.lgy.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ./chaincode/:/opt/gopath/src/github.com/chaincode
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
      - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/

peer0org2.yaml

version: '2'

services:
  couchdb2:
    container_name: couchdb2
    image: hyperledger/fabric-couchdb
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=123456
    ports:
      - 5984:5984

  peer0.org2.lgy.com:
    container_name: peer0.org2.lgy.com
    image: hyperledger/fabric-peer:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - CORE_PEER_ID=peer0.org2.lgy.com
      - CORE_PEER_ADDRESS=peer0.org2.lgy.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org2.lgy.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.lgy.com:8051
      - - CORE_PEER_GOSSIP_ENDPOINT=peer0.org2.lgy.com:8051
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.lgy.com:8051
      - CORE_PEER_LOCALMSPID=Org2MSP
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft-cluster_default
      - FABRIC_LOGGING_SPEC=INFO
      #- FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - 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
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb2:5984
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456
    depends_on:
      - couchdb2
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org2.lgy.com/peers/peer0.org2.lgy.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org2.lgy.com/peers/peer0.org2.lgy.com/tls:/etc/hyperledger/fabric/tls
    ports:
      - 8051:7051
      - 8052:7052
      - 8053:7053

  cli0:
    container_name: cli0
    image: hyperledger/fabric-tools:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    tty: true
    stdin_open: true
    environment:
      #- SYS_CHANNEL=$SYS_CHANNEL
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli0
      - CORE_PEER_ADDRESS=peer0.org2.lgy.com:8051
      - CORE_PEER_LOCALMSPID=Org2MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer0.org2.lgy.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer0.org2.lgy.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer0.org2.lgy.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/users/Admin@org2.lgy.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ./chaincode/:/opt/gopath/src/github.com/chaincode
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
      - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/

peer1org1.yaml

version: '2'

services:
  couchdb1:
    container_name: couchdb1
    image: hyperledger/fabric-couchdb
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=123456
    ports:
      - 5984:5984

  peer1.org1.lgy.com:
    container_name: peer1.org1.lgy.com
    image: hyperledger/fabric-peer:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - CORE_PEER_ID=peer1.org1.lgy.com
      - CORE_PEER_ADDRESS=peer1.org1.lgy.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org1.lgy.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.lgy.com:8051
      - CORE_PEER_GOSSIP_ENDPOINT=peer1.org1.lgy.com:8051
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.lgy.com:8051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft_clustor_default
      - FABRIC_LOGGING_SPEC=INFO
      #- FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - 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
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456
    depends_on:
      - couchdb1
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.lgy.com/peers/peer1.org1.lgy.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org1.lgy.com/peers/peer1.org1.lgy.com/tls:/etc/hyperledger/fabric/tls
    ports:
      - 8051:7051
      - 8052:7052
      - 8053:7053

  cli1:
    container_name: cli1
    image: hyperledger/fabric-tools:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    tty: true
    stdin_open: true
    environment:
      #- SYS_CHANNEL=$SYS_CHANNEL
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli1
      - CORE_PEER_ADDRESS=peer1.org1.lgy.com:8051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer1.org1.lgy.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer1.org1.lgy.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/peers/peer1.org1.lgy.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.lgy.com/users/Admin@org1.lgy.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ./chaincode/:/opt/gopath/src/github.com/chaincode
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
      - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/

peer1org2.yaml

version: '2'

services:
  couchdb1:
    container_name: couchdb1
    image: hyperledger/fabric-couchdb
    environment:
      - COUCHDB_USER=admin
      - COUCHDB_PASSWORD=123456
    ports:
      - 5984:5984

  peer1.org2.lgy.com:
    container_name: peer1.org2.lgy.com
    image: hyperledger/fabric-peer:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    environment:
      - CORE_PEER_ID=peer1.org2.lgy.com
      - CORE_PEER_ADDRESS=peer1.org2.lgy.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org2.lgy.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.lgy.com:8051
      - CORE_PEER_GOSSIP_ENDPOINT=peer1.org2.lgy.com:8051
      #- CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.lgy.com:8051
      - CORE_PEER_LOCALMSPID=org2MSP
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=raft_clustor_default
      - FABRIC_LOGGING_SPEC=INFO
      #- FABRIC_LOGGING_SPEC=DEBUG
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - 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
      - CORE_LEDGER_STATE_STATEDATABASE=CouchDB
      - CORE_LEDGER_STATE_COUCHDBCONFIG_COUCHDBADDRESS=couchdb1:5984
      - CORE_LEDGER_STATE_COUCHDBCONFIG_USERNAME=admin
      - CORE_LEDGER_STATE_COUCHDBCONFIG_PASSWORD=123456
    depends_on:
      - couchdb1
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org2.lgy.com/peers/peer1.org2.lgy.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org2.lgy.com/peers/peer1.org2.lgy.com/tls:/etc/hyperledger/fabric/tls
    ports:
      - 8051:7051
      - 8052:7052
      - 8053:7053

  cli1:
    container_name: cli1
    image: hyperledger/fabric-tools:1.4.6
    extends:
      file: base/base.yaml
      service: rafthosts
    tty: true
    stdin_open: true
    environment:
      #- SYS_CHANNEL=$SYS_CHANNEL
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli1
      - CORE_PEER_ADDRESS=peer1.org2.lgy.com:8051
      - CORE_PEER_LOCALMSPID=org2MSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer1.org2.lgy.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer1.org2.lgy.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/peers/peer1.org2.lgy.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.lgy.com/users/Admin@org2.lgy.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ./chaincode/:/opt/gopath/src/github.com/chaincode
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
      - ./peer:/opt/gopath/src/github.com/hyperledger/fabric/peer/

相关文章

网友评论

      本文标题:Fabric1.4.6多机多节点搭建(etcdraft)

      本文链接:https://www.haomeiwen.com/subject/wqqvzhtx.html