多机部署Fabric2.x(RAFT)版本

fabric局域网多机链管理目录

  1. 《局域网环境、多机部署Fabric2.x版本(RAFT共识算法)+ 通道创建》

  2. 《fabric2.0局域网多机版链码部署、调用、升级》

  3. 《fabric2.0局域网多机版锚节点更新》

环境

  1. Linux CentOS 7.4

    准备好三台虚拟机,IP地址:

    192.168.1.25   (orderer 排序组织)
    192.168.1.26    (org.peer0)
    192.168.1.27    (org.peer1)
    

    保证其网络正常访问

  2. wget

    确保wget命令正常使用,安装方式如下:

    #yum install wget
    #wget --version
    - GNU Wget 1.14 built on linux-gnu.
    
  3. unzip

    确保unzip命令正常使用,安装方式如下:

    #yum install unzip
    #unzip --version
    
  4. docker

    确保docker已经安装,安装方式如下:

#下载repo文件
wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo
#把软件仓库地址替换为 TUNA
sed -i 's+download.docker.com+mirrors.tuna.tsinghua.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
#安装docker
yum -y install docker-ce
docker -v
#-Docker version 19.03.8, build afacb8b
#启动并加入开机启动
systemctl start docker
systemctl enable docker
  • 如有使用本地harbor私服。增加如下配置
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
    "exec-opts": ["native.cgroupdriver=systemd"],
    "log-driver": "json-file",
    "insecure-registries": ["ip:port"],
    "log-opts": {
      "max-size": "10m"
    }
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
docker login `ip:port` -u `admin` -p `pwd`
  1. docker-compose

    确保docker-compose命令正常使用,安装方式如下:

#从国内镜像 get.daocloud.io 快速下载 
curl -L https://get.daocloud.io/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose 
#给执行文件添加执行权限
chmod +x /usr/local/bin/docker-compose
docker-compose --version
#-docker-compose version 1.23.2, build 1110ad01

准备工作

  1. 文件夹创建

    三台主机分别执行:

    mkdir /data/fabric      #fabric文件夹名字需要与后续对应
    cd /data/fabric
    mkdir chaincode         #存放链码文件
    mkdir channel-artifacts #存放区块链配置类文件
    mkdir ledger            #存放账本数据
    
  2. 镜像拉取(使用harbor私服)

  • orderer主机

    docker pull 192.168.1.212:8080/fabric/fabric-orderer:2.0.0
    
  • org主机(peer0和peer1)

    docker pull 192.168.1.212:8080/fabric/fabric-tools:2.0.0
    docker pull 192.168.1.212:8080/fabric/fabric-peer:2.0.0
    docker pull 192.168.1.212:8080/fabric/fabric-ccenv:2.2.0
    docker tag 192.168.1.212:8080/fabric/fabric-ccenv:2.2.0 hyperledger/fabric-ccenv:2.2
    docker pull 192.168.1.212:8080/fabric/fabric-baseos:2.2.0
    docker tag 192.168.1.212:8080/fabric/fabric-baseos:2.2.0 hyperledger/fabric-baseos:2.2
    
    #后面两个在链码安装时候需要用的镜像。官方使用的默认的镜像名字,因为本例子使用了私服,故需要改成默认镜像名字。
    
  1. 工具准备

    fabric2.0编译工具hyperledger-fabric-linux-amd64-2.0.0.tar.gz(点击下载)下载后上传至orderer主机(192.168.1.25)

[root@localhost fabric]# tar -zxvf hyperledger-fabric-linux-amd64-2.0.0.tar.gz 
bin/
bin/configtxgen
bin/orderer
bin/peer
bin/discover
bin/idemixgen
bin/configtxlator
bin/cryptogen
config/
config/configtx.yaml
config/core.yaml
config/orderer.yaml
[root@localhost fabric]# ls
bin  config  hyperledger-fabric-linux-amd64-2.0.0.tar.gz
[root@localhost fabric]# cp bin/* /usr/bin/

配置文件准备

  1. configtx.yaml(注意格式!!!)
# configtx.yaml
---
Organizations:
  - &OrdererOrg
      Name: OrdererOrg
      ID: OrdererMSP
      MSPDir: crypto-config/ordererOrganizations/test.com/msp
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('OrdererMSP.member')"
          Writers:
              Type: Signature
              Rule: "OR('OrdererMSP.member')"
          Admins:
              Type: Signature
              Rule: "OR('OrdererMSP.admin')"
      OrdererEndpoints:
                    - orderer.test.com:7050
  - &org
      Name: orgMSP
      ID: orgMSP
      MSPDir: crypto-config/peerOrganizations/org.test.com/msp
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('orgMSP.admin', 'orgMSP.peer', 'orgMSP.client')"
          Writers:
              Type: Signature
              Rule: "OR('orgMSP.admin', 'orgMSP.client')"
          Admins:
              Type: Signature
              Rule: "OR('orgMSP.admin')"
          Endorsement:
              Type: Signature
              Rule: "OR('orgMSP.peer')"
      AnchorPeers:
          - Host: peer0.org.test.com
            Port: 7051
Capabilities:
  Global: &ChannelCapabilities
      V2_0: true
  Orderer: &OrdererCapabilities
      V2_0: true
  Application: &ApplicationCapabilities
      V2_0: true
Application: &ApplicationDefaults
  Organizations:
  Policies:
      Readers:
          Type: ImplicitMeta
          Rule: "ANY Readers"
      Writers:
          Type: ImplicitMeta
          Rule: "ANY Writers"
      Admins:
          Type: ImplicitMeta
          Rule: "MAJORITY Admins"
      LifecycleEndorsement:
          Type: ImplicitMeta
          Rule: "MAJORITY Endorsement"
      Endorsement:
          Type: ImplicitMeta
          Rule: "MAJORITY Endorsement"
  Capabilities:
      <<: *ApplicationCapabilities
Orderer: &OrdererDefaults
  OrdererType: etcdraft
  Addresses:
                    - orderer.test.com:7050
  BatchTimeout: 1s
  BatchSize:
      MaxMessageCount: 100
      AbsoluteMaxBytes: 99 MB
      PreferredMaxBytes: 512 KB
  EtcdRaft:  
      Consenters:
            - Host: orderer.test.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/test.com/orderers/orderer.test.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/test.com/orderers/orderer.test.com/tls/server.crt
      Options:
            TickInterval: 500ms
            ElectionTick: 10
            HeartbeatTick: 1
            MaxInflightBlocks: 5
            SnapshotIntervalSize: 20971520
  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:
  tbsGenesis:
      <<: *ChannelDefaults
      Orderer:
          <<: *OrdererDefaults
          Organizations:
              - *OrdererOrg
          Capabilities:
              <<: *OrdererCapabilities
      Consortiums:
          tbsConsortium:
              Organizations:
                    - *org
  channel-1:         #后续创建通道
      Consortium: tbsConsortium
      <<: *ChannelDefaults
      Application:
          <<: *ApplicationDefaults
          Organizations:
                    - *org

          Capabilities:
              <<: *ApplicationCapabilities   


  1. cryptogen.yaml(注意格式!!!)
OrdererOrgs:
- Name: Orderer
  Domain: test.com
  Specs:
                    - Hostname: orderer
PeerOrgs:
- Name: org
  Domain: org.test.com
  EnableNodeOUs: true
  Template:
    Count: 2   #节点个数
  Users:
    Count: 2
  1. docker-compose-orderer.yaml(注意格式!!!)
version: '2'
services:
  orderer.test.com:
    container_name: orderer.test.com
    image: 192.168.1.212:8080/fabric/fabric-orderer:2.0.0
    environment:
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_default        #fabric_default 中的 fabric 与前文文件夹名字对应
      - ORDERER_GENERAL_LOGLEVEL=debug
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=7050
      - 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_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_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/test.com/orderers/orderer.test.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/test.com/orderers/orderer.test.com/tls/:/var/hyperledger/orderer/tls
    networks:
      default:
          aliases:
            - fabric
    ports:
      - 7050:7050
    extra_hosts:
                    - "orderer.test.com:192.168.1.25"

  1. docker-compose-peer.yaml(注意格式!!!)
  • 192.168.1.26 (peer0)
version: '2'
services:
  peer0.org.test.com:
    container_name: peer0.org.test.com
    image: 192.168.1.212:8080/fabric/fabric-peer:2.0.0
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_default
      - CORE_LOGGING_LEVEL=INFO
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - CORE_PEER_LOCALMSPID=orgMSP
      - CORE_PEER_ID=peer0.org.test.com
      - CORE_PEER_ADDRESS=peer0.org.test.com:7051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org.test.com:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org.test.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org.test.com:7051
      - CORE_PEER_TLS_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
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org.test.com/peers/peer0.org.test.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org.test.com/peers/peer0.org.test.com/tls:/etc/hyperledger/fabric/tls
      - ./ledger:/var/hyperledger/production
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    networks:
      default:
        aliases:
          - fabric
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    extra_hosts:  # 声明域名和IP的对应关系
                    - "orderer.test.com:192.168.1.25"
                    - "peer0.org.test.com:192.168.1.26"
                    - "peer1.org.test.com:192.168.1.27"
  cli:
    container_name: cli
    image: 192.168.1.212:8080/fabric/fabric-tools:2.0.0
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=INFO
      - CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS=peer0.org.test.com:7051
      - CORE_PEER_LOCALMSPID=orgMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer0.org.test.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer0.org.test.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer0.org.test.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/users/Admin@org.test.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
    depends_on:   # 启动顺序
      - peer0.org.test.com
    networks:
        default:
          aliases:
            - fabric
    extra_hosts:
                    - "orderer.test.com:192.168.1.25"
                    - "peer0.org.test.com:192.168.1.26"
                    - "peer1.org.test.com:192.168.1.27"


  • 192.168.1.27 (peer1)
version: '2'
services:
  peer1.org.test.com:
    container_name: peer1.org.test.com
    image: 192.168.1.212:8080/fabric/fabric-peer:2.0.0
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=fabric_default
      - CORE_LOGGING_LEVEL=INFO
      - CORE_PEER_GOSSIP_USELEADERELECTION=true
      - CORE_PEER_GOSSIP_ORGLEADER=false
      - CORE_PEER_PROFILE_ENABLED=true
      - CORE_PEER_LOCALMSPID=orgMSP
      - CORE_PEER_ID=peer1.org.test.com
      - CORE_PEER_ADDRESS=peer1.org.test.com:7051
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org.test.com:7051
      - CORE_PEER_CHAINCODEADDRESS=peer1.org.test.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org.test.com:7051
      - CORE_PEER_TLS_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
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org.test.com/peers/peer1.org.test.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org.test.com/peers/peer1.org.test.com/tls:/etc/hyperledger/fabric/tls
      - ./ledger:/var/hyperledger/production
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    networks:
      default:
        aliases:
          - fabric
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    extra_hosts:  # 声明域名和IP的对应关系
                    - "orderer.test.com:192.168.1.25"
                    - "peer0.org.test.com:192.168.1.26"
                    - "peer1.org.test.com:192.168.1.27"
  cli:
    container_name: cli
    image: 192.168.1.212:8080/fabric/fabric-tools:2.0.0
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_LOGGING_LEVEL=INFO
      - CORE_PEER_ID=cli
      - CORE_PEER_ADDRESS=peer1.org.test.com:7051
      - CORE_PEER_LOCALMSPID=orgMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer1.org.test.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer1.org.test.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/peers/peer1.org.test.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org.test.com/users/Admin@org.test.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
    depends_on:   # 启动顺序
      - peer1.org.test.com

    networks:
        default:
          aliases:
            - fabric
    extra_hosts:
                    - "orderer.test.com:192.168.1.25"
                    - "peer0.org.test.com:192.168.1.26"
                    - "peer1.org.test.com:192.168.1.27"


部署fabric网络

  1. 配置文件上传

    • configtx.yamlcryptogen.yamldocker-compose-orderer.yaml文件上传至 orderer主机(192.168.1.25) /data/fabric/ 目录下
    • docker-compose-peer0.yaml文件上传至 peer0主机(192.168.1.26) /data/fabric/ 目录下
    • docker-compose-peer1.yaml文件上传至 peer1主机(192.168.1.27) /data/fabric/ 目录下
  2. 生成证书:(在orderer主机(192.168.1.25) /data/fabric/ 目录下执行)

    cryptogen generate --config=./cryptogen.yaml --output='crypto-config' 
    
  3. 证书文件scp至其他主机。(严格意义上讲,当前主机只允许拥有自身组织节点的私钥。其他组织节点的需要删除)

    scp -r  crypto-config/* root@192.168.1.26:/data/fabric/crypto-config/
    scp -r  crypto-config/* root@192.168.1.27:/data/fabric/crypto-config/
    
  4. 生成创世区块:(或创建系统通道,仅执行一次)

    configtxgen -profile tbsGenesis -outputBlock ./channel-artifacts/genesis.block -channelID tbs-sys-channel
    

    得到genesis.block即可

    [root@localhost fabric]# ls channel-artifacts/
    genesis.block
    
  5. 启动网络

  • orderer主机(192.168.1.25)

      docker-compose -f docker-compose-orderer.yaml up -d
      [root@localhost fabric]# docker ps
      CONTAINER ID        IMAGE                                            COMMAND             CREATED             STATUS              PORTS                    NAMES
      ca29dbea8ea3        192.168.1.212:8080/fabric/fabric-orderer:2.0.0   "orderer"           3 seconds ago       Up 2 seconds        0.0.0.0:7050->7050/tcp   orderer.test.com
    
  • peer0主机(192.168.1.26)

      docker-compose -f docker-compose-peer0.yaml up -d
      [root@localhost fabric]# docker ps
      CONTAINER ID        IMAGE                                          COMMAND             CREATED             STATUS              PORTS                              NAMES
      f805245f7754        192.168.1.212:8080/fabric/fabric-tools:2.0.0   "/bin/bash"         2 seconds ago       Up 2 seconds                                           cli
      ffca760f1e31        192.168.1.212:8080/fabric/fabric-peer:2.0.0    "peer node start"   3 seconds ago       Up 2 seconds        0.0.0.0:7051-7053->7051-7053/tcp   peer0.org.test.com
    
  • peer1主机(192.168.1.27)

      docker-compose -f docker-compose-peer1.yaml up -d
      [root@localhost fabric]# docker ps
      CONTAINER ID        IMAGE                                          COMMAND             CREATED             STATUS              PORTS                              NAMES
      f82baca19c0b        192.168.1.212:8080/fabric/fabric-tools:2.0.0   "/bin/bash"         2 seconds ago       Up 1 second                                            cli
      fc931a1463bb        192.168.1.212:8080/fabric/fabric-peer:2.0.0    "peer node start"   3 seconds ago       Up 2 seconds        0.0.0.0:7051-7053->7051-7053/tcp   peer1.org.test.com
    
  • 完成后网络启动成功!

创建通道

  1. 生成通道文件channel-1.tx (或生成业务通道文件。在orderer主机(192.168.1.25) /data/fabric/ 目录下执行)

    configtxgen -profile channel-1 -outputCreateChannelTx ./channel-artifacts/channel-1.tx -channelID channel-1
    注:channel-1 为通道名称 需在configtx.yaml 文件中进行相应配置
    

得到channel-1.tx即可

[root@localhost fabric]# ls channel-artifacts/
channel-1.tx  genesis.block

  1. 创世区块文件scp至组织各节点主机:即:peer0、peer1

    scp ./channel-artifacts/* root@192.168.1.26:/data/fabric/channel-artifacts/
    scp ./channel-artifacts/* root@192.168.1.27:/data/fabric/channel-artifacts/
    
  2. 生成区块文件 (在peer0执行)

[root@localhost fabric]# docker exec cli peer channel create -o orderer.test.com:7050 -c channel-1 -f ./channel-artifacts/channel-1.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/test.com/msp/tlscacerts/tlsca.test.com-cert.pem --outputBlock ./channel-artifacts/channel-1.block
2021-05-13 06:57:48.057 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 06:57:48.062 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 06:57:48.306 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2021-05-13 06:57:48.323 UTC [cli.common] readBlock -> INFO 004 Expect block, but got status: &{NOT_FOUND}
2021-05-13 06:57:48.326 UTC [channelCmd] InitCmdFactory -> INFO 005 Endorser and orderer connections initialized
2021-05-13 06:57:48.527 UTC [cli.common] readBlock -> INFO 006 Expect block, but got status: &{NOT_FOUND}
2021-05-13 06:57:48.532 UTC [channelCmd] InitCmdFactory -> INFO 007 Endorser and orderer connections initialized
2021-05-13 06:57:48.962 UTC [cli.common] readBlock -> INFO 008 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2021-05-13 06:57:48.965 UTC [channelCmd] InitCmdFactory -> INFO 009 Endorser and orderer connections initialized
2021-05-13 06:57:49.167 UTC [cli.common] readBlock -> INFO 00a Expect block, but got status: &{SERVICE_UNAVAILABLE}
2021-05-13 06:57:49.170 UTC [channelCmd] InitCmdFactory -> INFO 00b Endorser and orderer connections initialized
2021-05-13 06:57:49.371 UTC [cli.common] readBlock -> INFO 00c Expect block, but got status: &{SERVICE_UNAVAILABLE}
2021-05-13 06:57:49.374 UTC [channelCmd] InitCmdFactory -> INFO 00d Endorser and orderer connections initialized
2021-05-13 06:57:49.577 UTC [cli.common] readBlock -> INFO 00e Expect block, but got status: &{SERVICE_UNAVAILABLE}
2021-05-13 06:57:49.580 UTC [channelCmd] InitCmdFactory -> INFO 00f Endorser and orderer connections initialized
2021-05-13 06:57:49.781 UTC [cli.common] readBlock -> INFO 010 Expect block, but got status: &{SERVICE_UNAVAILABLE}
2021-05-13 06:57:49.784 UTC [channelCmd] InitCmdFactory -> INFO 011 Endorser and orderer connections initialized
2021-05-13 06:57:49.987 UTC [cli.common] readBlock -> INFO 012 Received block: 0

[root@localhost fabric]# ls channel-artifacts/
channel-1.block  channel-1.tx  genesis.block

  1. 复制区块文件至其他peer节点 (scp至 peer1
	scp ./channel-artifacts/channel-1.block root@192.168.1.27:/data/fabric/channel-artifacts/
  1. 节点加入通道 (peer0peer1加入channel-1,在peer0peer1主机上分别执行)
[root@localhost fabric]#  docker exec cli peer channel join -b ./channel-artifacts/channel-1.block
2021-05-13 07:03:32.807 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 07:03:32.811 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 07:03:32.976 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
2021-05-13 07:03:33.268 UTC [channelCmd] executeJoin -> INFO 004 Successfully submitted proposal to join channel

  1. 校验是否成功(在peer0peer1主机上分别执行)
[root@localhost fabric]# docker exec cli peer channel list
2021-05-13 07:04:15.913 UTC [main] InitCmd -> WARN 001 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 07:04:15.917 UTC [main] SetOrdererEnv -> WARN 002 CORE_LOGGING_LEVEL is no longer supported, please use the FABRIC_LOGGING_SPEC environment variable
2021-05-13 07:04:15.921 UTC [channelCmd] InitCmdFactory -> INFO 003 Endorser and orderer connections initialized
Channels peers has joined: 
channel-1

  • 至此网络部署成功、通道创建成功

下一篇:fabric2.0局域网多机版链码部署、调用、升级

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐