fabric2.4系列教程:第一章 单机搭建多组织多节点网络

系列文章目录

fabric2.4系列教程:第一章 单机搭建多组织多节点网络



一:vmware安装Ubuntu18虚拟机

centos 与 ubuntu 没有本质区别 仅基本工具安装方法不同 go、docker、docker-compose、jdk11。
先把源换成国内源:/etc/apt/sources.list 百度个163源 ubuntu18的替换进去。
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic stable

(一)安装虚拟机

具体过程略过,配置 cpu6核 内存10G 磁盘100G,配置用不了这么高,2C4G应该就够测试了。

(二)安装openjdk 11

sudo apt install openjdk-11-jdk

(三)安装go1.18

ubuntu20安装go1.18 https://blog.csdn.net/xiaoyujiale/article/details/125497945

(四)安装docker、docker-compose

新建脚本文件复制进脚本执行安装(compose 有时下载不下来 1重试几遍、2翻墙(https://v3.nanoport.xyz/)、3输出下载链接用迅雷下载,将文件拷贝至/usr/local/bin/目录下,执行sudo chmod +x /usr/local/bin/docker-compose)
不行就参考别人的教程网上一大把:https://blog.csdn.net/u012590718/article/details/125702606

#!/bin/bash
COMPOSE_VERSION="1.27.4"

function docker_install() {
	if [ `dpkg -l|grep docker|wc -l` -eq 0 ];then
		sudo apt-get update
		sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
		curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
		sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
		sudo apt-get -y update
		sudo apt-get -y install docker-ce
	fi
	if [ ! -f /etc/docker/daemon.json ];then
		cat <<EOF > /etc/docker/daemon.json
{
    "registry-mirrors": ["https://p36nia6c.mirror.aliyuncs.com"],
    "log-driver":"json-file",
    "log-opts": {"max-size":"2g", "max-file":"3"}
}
EOF
systemctl daemon-reload && systemctl restart docker
	fi
	systemctl enable docker
}
function compose_install() {
	if [ ! -f /usr/local/bin/docker-compose ];then
		#sudo curl -L "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose &&\
		curl -L https://get.daocloud.io/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
		sudo chmod +x /usr/local/bin/docker-compose
	fi
}

docker_install
compose_install

二、fabric2.4.2网络构建

(一)基本环境

便捷操作顺便把fabric-sample 也操作了,使用fabric来初始化相关环境,因为写文章时还是2.4系列,后续fabric-sample可能更新需要切换到2.4,或者尝试最新的是否可以。

#当前机器因为安装go时采用的是家目录下新建sdk/go目录,没有就新建目录(mkdir -p ~/sdk/go),
#使用 cat ~/.bashrc 命令输出文件 中 gopath
#所以后续操作均在该目录中操作(cd ~/sdk/go)
mkdir -p ~/sdk/go
cd ~/sdk/go
mkdir multiple-deployment #后期实际部署目录
mkdir multiple-deployment1 #后期实际部署目录
mkdir multiple-deployment2 #后期实际部署目录
git clone https://github.com/hyperledger/fabric #下载不了或者太慢了就用迅雷、或者翻墙
cd ~/sdk/go/fabric/scripts #进入脚本执行目录
git checkout v2.4.2 #切换至文档对应分支
sudo ./bootstrap.sh #执行脚本 下载fabric 镜像,启动文件(翻墙可直接下载、不翻墙备注:)
#备注:
#单独下载下面两个文件(迅雷下载):
#https://github.com/hyperledger/fabric/releases/download/v2.4.2/hyperledger-fabric-linux-amd64-2.4.2.tar.gz
#https://github.com/hyperledger/fabric-ca/releases/download/v1.5.2/hyperledger-fabric-ca-linux-amd64-1.5.2.tar.gz
#
#修改bootstrap.sh
#屏蔽如下代码:下载文件
if [ "$BINARIES" == "true" ]; then
    echo
    echo "Pull Hyperledger Fabric binaries"
    echo
    pullBinaries
fi
#再重新执行脚本、建议搞个代理,省事。同事同学问问都有的。
#将下载的两个文件 拷贝至~/sdk/go/fabric/scripts/fabric-samples/  目录下解压
sudo su #切换root
echo 'export PATH=$PATH:/home/ginvip/sdk/go/fabric/scripts/fabric-samples/bin' >>/etc/profile
echo 'export FABRIC_CFG_PATH=/sdk/go/multiple-deployment' >> /etc/profile
ctrl + d 退出root权限
source /etc/profile

(二)启动测试网络

参考 https://github.com/hyperledger/fabric-samples/tree/main/token-erc-721

(三)搭建生产网络

1 生成证书文件

cd ~/sdk/go/multiple-deployment

创建文件crypto-config.yaml录入如下文件内容

# 该文件为创建fabric网络的第一个文件
# 生成各组织证书使用(生成命令 配置该配置文件方式,会生成证书目录)
#当前生成order组织下有三个成员,共识组织三个,共识组织下证书数量2个(节点),用户证书一个
# 命令1:在配置文件目录执行命令:`cryptogen generate --config=./crypto-config.yaml`
# 生成 crypto-config 文件夹内有order、peer证书文件
# 
OrdererOrgs:
  - Name: Orderer
    #可修改order(排序)组织域名,例如zhaowu.com->chenhaninfo.com
    Domain: zhaowu.com
    #order组织下成员名称(包含三个order成员)
    Specs:
      - Hostname: agridepartorderer
      - Hostname: agrimacownerorderer
      - Hostname: financedepartorderer

PeerOrgs:
    #共识组织名
  - Name: Agridepart
    #域名可以更改,需将对应的都修改
    Domain: agridepart.zhaowu.com
    #使能证书
    EnableNodeOUs: true
    Template:
    #生成证书的数量
      Count: 2 
    Users:
    #生成用户证书个数
      Count: 1 
  - Name: Agrimacowner
    Domain: agrimacowner.zhaowu.com
    EnableNodeOUs: true
    Template:
      Count: 2
    Users:
      Count: 1
  - Name: Financedepart
    Domain: financedepart.zhaowu.com
    EnableNodeOUs: true
    Template:
      Count: 2
    Users:
      Count: 1

2 生成策略文件

cd ~/sdk/go/multiple-deployment 创建configtx.yaml文件

# 第二步:组织启动权限参数配置
# 命令1:configtxgen -profile SampleMultiNodeEtcdRaft -channelID zhaowudeploy -outputBlock ./channel-artifacts/genesis.block
# 生成创世文件channel-artifacts/genesis.block
# 命令2:configtxgen -profile ThreeOrgsChannel -outputCreateChannelTx ./channel-artifacts/channel.tx -channelID zhaowu
# 生成通道文件channel-artifacts/channel.tx
# 命令3:configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/AgridepartMSPanchors.tx -channelID zhaowu -asOrg AgridepartMSP
# 生成AgridepartMSP通道文件
# 命令4:configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/AgrimacownerMSPanchors.tx -channelID zhaowu -asOrg AgrimacownerMSP
# 生成AgrimacownerMSP通道文件
# 命令5:configtxgen -profile ThreeOrgsChannel -outputAnchorPeersUpdate ./channel-artifacts/FinancedepartMSPanchors.tx -channelID zhaowu -asOrg FinancedepartMSP
# 生成FinancedepartMSP通道文件

# 将第一步、第二步生成文件夹channel-artifacts、crypto-config拷贝至另外两台机器或组织目录,用于初始化。理论上只用拷贝对应的组织信息即可。
---
Organizations:
#配置排序节点的名称、id、成员目录、读写权限、管理员权限
    - &OrdererOrg
        Name: OrdererOrg
        ID: OrdererMSP
        MSPDir: crypto-config/ordererOrganizations/zhaowu.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"
#配置 组织1(记账/共识组织)的名称、id、成员目录、读写权限、管理员权限、领导者
    - &Agridepart
        Name: AgridepartMSP
        ID: AgridepartMSP
        MSPDir: crypto-config/peerOrganizations/agridepart.zhaowu.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('AgridepartMSP.admin', 'AgridepartMSP.peer', 'AgridepartMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('AgridepartMSP.admin', 'AgridepartMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('AgridepartMSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('AgridepartMSP.peer')"

        AnchorPeers:
            - Host: peer0.agridepart.zhaowu.com
              Port: 7051
#配置 组织2(记账/共识组织)的名称、id、成员目录、读写权限、管理员权限、领导者
    - &Agrimacowner
        Name: AgrimacownerMSP
        ID: AgrimacownerMSP
        MSPDir: crypto-config/peerOrganizations/agrimacowner.zhaowu.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('AgrimacownerMSP.admin', 'AgrimacownerMSP.peer', 'AgrimacownerMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('AgrimacownerMSP.admin', 'AgrimacownerMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('AgrimacownerMSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('AgrimacownerMSP.peer')"

        AnchorPeers:
            - Host: peer0.agrimacowner.zhaowu.com
              Port: 17051
#配置 组织3(记账/共识组织)的名称、id、成员目录、读写权限、管理员权限、领导者
    - &Financedepart
        Name: FinancedepartMSP
        ID: FinancedepartMSP
        MSPDir: crypto-config/peerOrganizations/financedepart.zhaowu.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('FinancedepartMSP.admin', 'FinancedepartMSP.peer', 'FinancedepartMSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('FinancedepartMSP.admin', 'FinancedepartMSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('FinancedepartMSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('FinancedepartMSP.peer')"

        AnchorPeers:
            - Host: peer0.financedepart.zhaowu.com
              Port: 27051
# 通道、排序、应用权限引入
Capabilities:
    Channel: &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
    # 排序节点共识类型raft
    OrdererType: etcdraft

    Addresses: # orderer 集群节点
        - agridepartorderer.zhaowu.com:7050
        - agrimacownerorderer.zhaowu.com:17050
        - financedepartorderer.zhaowu.com:27050
    # Batch Timeout: The amount of time to wait before creating a batch
    BatchTimeout: 2s
    # Batch Size: Controls the number of messages batched into a block
    BatchSize:
        MaxMessageCount: 10000
        AbsoluteMaxBytes: 990 MB
        PreferredMaxBytes: 5 MB

    Organizations:

    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        # BlockValidation specifies what signatures must be included in the block
        # from the orderer for the peer to validate it.
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

Channel: &ChannelDefaults

    Policies:
        # Who may invoke the 'Deliver' API
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Who may invoke the 'broadcast' API
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # By default, who may modify elements at this config level
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ChannelCapabilities

Profiles:

    ThreeOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Agridepart
                - *Agrimacowner
                - *Financedepart
            Capabilities:
                <<: *ApplicationCapabilities

    SampleMultiNodeEtcdRaft:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            OrdererType: etcdraft
            EtcdRaft:
                Consenters:
                - Host: agridepartorderer.zhaowu.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/tls/server.crt
                - Host: agrimacownerorderer.zhaowu.com
                  Port: 17050
                  ClientTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/agrimacownerorderer.zhaowu.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/agrimacownerorderer.zhaowu.com/tls/server.crt
                - Host: financedepartorderer.zhaowu.com
                  Port: 27050
                  ClientTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/financedepartorderer.zhaowu.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/zhaowu.com/orderers/financedepartorderer.zhaowu.com/tls/server.crt
            Addresses:
                - agridepartorderer.zhaowu.com:7050
                - agrimacownerorderer.zhaowu.com:17050
                - financedepartorderer.zhaowu.com:27050
            Organizations:
            - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Application:
            <<: *ApplicationDefaults
            Organizations:
            - <<: *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                - *Agridepart
                - *Agrimacowner
                - *Financedepart

3.配置docker启动文件

配置hosts文件 vi /etc/hosts 使实际启动网络时域名可以找到对应的服务器ip

192.168.200.152 agridepartorderer.zhaowu.com
192.168.200.152 agrimacownerorderer.zhaowu.com
192.168.200.152 peer0.agridepart.zhaowu.com
192.168.200.152 peer1.agridepart.zhaowu.com
192.168.200.152 peer0.agrimacowner.zhaowu.com
192.168.200.152 peer1.agrimacowner.zhaowu.com
192.168.200.152 financedepartorderer.zhaowu.com
192.168.200.152 peer0.financedepart.zhaowu.com
192.168.200.152 peer1.financedepart.zhaowu.com

配置文件后(3.1、3.2 、3.3) 按如下内容进行操作

# 配置docker 容器参数,统一机器启动多个时注意重名问题。
#当前使用一台机器工作目录:~/fabric/go/src/github.com/hyperledger/zhaowu
#三个文件夹(三个组织)分别multiple-deployment:agridepart、multiple-deployment1:agrimacowner、multiple-deployment2:financedepart
#将 在三.(二)测试网络中执行“./network.sh deployCC -ccn token_erc721 -ccp ../token-erc-721/chaincode-javascript/ -ccl javascript” 该命令生成的合约(token_erc721.tar.gz)分别拷贝至三个(multiple-deployment)目录下的chaincode(没有则创建一个文件夹中进行操作
# 第三步:启动网络 三个文件对应 执行三次,在同一目录下
# 命令1:docker-compose up -d  # 停止命令docker-compose down
# 启动 ca、order、peer0、peer1、cli1、cli2 容器 名称与container_name 对应相同。

# 第四步:在容器内进行通道创建与组织更新。
# 命令1:sudo docker exec -it cli1 bash
# 进入容器cli1
# 命令2:peer channel create -o agridepartorderer.zhaowu.com:7050 -c zhaowu -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 为peer0 创建通道文件
# 命令3:peer channel join -b zhaowu.block
# 将peer节点通道内加入区块文件 
# 命令4:peer channel update -o agridepartorderer.zhaowu.com:7050 -c zhaowu -f ./channel-artifacts/AgridepartMSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 更新通道文件
# 命令5:ctrl + d
# 退出容器,回到宿主机

# 命令6:docker cp cli1:/opt/gopath/src/github.com/hyperledger/fabric/peer/zhaowu.block ./
# 拷贝区块文件至宿主机

# 命令7:docker cp zhaowu.block cli2:/opt/gopath/src/github.com/hyperledger/fabric/peer/
# 拷贝区块文件到cli2容器内
# 命令8:sudo docker exec -it cli2 bash
# 进入容器cli2
# 命令9:peer channel join -b zhaowu.block
# 将peer节点通道内加入区块文件 
# 命令10:ctrl + d
# 退出容器,回到宿主机
# 
# 第五步:注意3,4步骤中的域名及端口的修改配置文件对应上
# 1.将zhaowu.block 分别拷贝至cli3、cli4、cli5、cli6容器 命令:参考cli2 操作命令:命令7
# 1.1:cli3在宿主机目录执行命令:sudo docker cp zhaowu.block cli3:/opt/gopath/src/github.com/hyperledger/fabric/peer/
# 1.2:cli4在宿主机目录执行命令:sudo docker cp zhaowu.block cli4:/opt/gopath/src/github.com/hyperledger/fabric/peer/
# 1.3:cli5在宿主机目录执行命令:sudo docker cp zhaowu.block cli5:/opt/gopath/src/github.com/hyperledger/fabric/peer/
# 1.4:cli6在宿主机目录执行命令:sudo docker cp zhaowu.block cli6:/opt/gopath/src/github.com/hyperledger/fabric/peer/
# 2.分别进入cli3、cli4、cli5、cli6 执行命令:peer channel join -b zhaowu.block 通道内加入创世文件
# 2.1进入容器命令:sudo docker exec -it cli3 bash  通道内加入账本文件命令:peer channel join -b zhaowu.block
# 2.1.2在cli3容器内更新各节点账本 命令:peer channel update -o agridepartorderer.zhaowu.com:7050 -c zhaowu -f ./channel-artifacts/AgrimacownerMSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 2.2进入容器命令:sudo docker exec -it cli4 bash  通道内加入账本文件命令:peer channel join -b zhaowu.block
# 2.3进入容器命令:sudo docker exec -it cli5 bash  通道内加入账本文件命令:peer channel join -b zhaowu.block
# 2.3.2在cli5容器内更新各节点账本 命令:peer channel update -o agridepartorderer.zhaowu.com:7050 -c zhaowu -f ./channel-artifacts/FinancedepartMSPanchors.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 2.4进入容器命令:sudo docker exec -it cli6 bash  通道内加入账本文件命令:peer channel join -b zhaowu.block
# 3 ctrl + d 退出各容器

# 第六步:操作合约(链码)的部署
# 当前启动了三个组织6个peer节点,3个order节点,3个ca节点分别位于:multiple-deployment、multiple-deployment1、multiple-deployment2三个目录启动,cli容器启动了6个分别两个属于一个组织cli1cli2、cli3cli4、cli5cli6。每个cli对应连接一个peer节点。
# 1.分别上传链码 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz至multiple-deployment、multiple-deployment1、multiple-deployment2目录的chaincode目录下(docker-compose配置中可修改目录)。
# 2.进入容器安装链码
# 2.1进入容器命令:sudo docker exec -it cli1 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 2.2进入容器命令:sudo docker exec -it cli2 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 2.3进入容器命令:sudo docker exec -it cli3 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 2.4进入容器命令:sudo docker exec -it cli4 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 2.5进入容器命令:sudo docker exec -it cli5 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 2.6进入容器命令:sudo docker exec -it cli6 bash  安装链码 peer lifecycle chaincode install ../../multiple-deployment/chaincode/7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX.tar.gz;
# 3.锚节点(AnchorPeers) 同意链码提交 仅容器cli1,cli3,cli5操作:配置文件(configtx.yaml)中定义的锚节点 package-id来自于安装链码返回的 chaincode code package identifier:
# 3.1 cli1执行命令: peer lifecycle chaincode approveformyorg --channelID zhaowu --name 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --version 1.0 --init-required --package-id 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX_1.0:f4df050ae2ffb3288f6d7b9d7f02489fa777e1fe5ada4da6dfe5e57f0479659a --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 3.2 cli3执行命令: peer lifecycle chaincode approveformyorg --channelID zhaowu --name 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --version 1.0 --init-required --package-id 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX_1.0:f4df050ae2ffb3288f6d7b9d7f02489fa777e1fe5ada4da6dfe5e57f0479659a --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 3.3 cli5执行命令: peer lifecycle chaincode approveformyorg --channelID zhaowu --name 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --version 1.0 --init-required --package-id 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX_1.0:f4df050ae2ffb3288f6d7b9d7f02489fa777e1fe5ada4da6dfe5e57f0479659a --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem
# 4 ctrl + d 退出各容器
# 5.任意进入一个锚节点容器验证链码安装成功
# 5.1 进入容器命令:sudo docker exec -it cli1 bash  查看命令:peer lifecycle chaincode checkcommitreadiness --channelID zhaowu --name 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --version 1.0 --init-required --sequence 1 --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem --output json
# 5.2 三个组织都返回true
# 6 提交链码:peer lifecycle chaincode commit -o agridepartorderer.zhaowu.com:7050 --channelID zhaowu --name 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --version 1.0 --sequence 1 --init-required --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem --peerAddresses peer0.agridepart.zhaowu.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls/ca.crt --peerAddresses peer0.agrimacowner.zhaowu.com:17051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls/ca.crt --peerAddresses peer0.financedepart.zhaowu.com:27051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls/ca.crt
# 7 初始化链码:peer chaincode invoke -o agridepartorderer.zhaowu.com:7050 --isInit --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp/tlscacerts/tlsca.zhaowu.com-cert.pem -C zhaowu -n 7BZDOUP5OIZLNMDXFIPJLVMZX2F75HBX --peerAddresses peer0.agridepart.zhaowu.com:7051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls/ca.crt --peerAddresses peer0.agrimacowner.zhaowu.com:17051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls/ca.crt --peerAddresses peer0.financedepart.zhaowu.com:27051 --tlsRootCertFiles /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls/ca.crt -c '{"function":"getClientAccountId","Args":[""]}' –waitForEvent
# 5.3 ctrl + d 退出容器
# 6.链码部署完成

3.1组织1及order1的docker-compose文件

在cd ~/sdk/go/multiple-deployment目录下新建docker-compose.yaml

# 配置docker 容器参数,统一机器启动多个时注意重名问题。
version: '2'

services:
  ca.agridepart.zhaowu.com:
    container_name: ca.agridepart.zhaowu.com
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca.agridepart.zhaowu.com
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.agridepart.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/priv_sk
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.agridepart.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/priv_sk
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/ca
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls
    ports:
      - "7054:7054"

  agridepartorderer.zhaowu.com:
    container_name: agridepartorderer.zhaowu.com
    image: hyperledger/fabric-orderer
    environment:
      - FABRIC_LOGGING_SPEC=DEBUG
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
      - ORDERER_GENERAL_BOOTSTRAPFILE=/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_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]
      - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
      - ORDERER_METRICS_PROVIDER=prometheus
    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/zhaowu.com/orderers/agridepartorderer.zhaowu.com/msp:/var/hyperledger/orderer/msp
        - ./crypto-config/ordererOrganizations/zhaowu.com/orderers/agridepartorderer.zhaowu.com/tls/:/var/hyperledger/orderer/tls
        - ./data/agridepartorderer.zhaowu.com:/var/hyperledger/production/orderer
    ports:
      - 7050:7050
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  peer0.agridepart.zhaowu.com:
    container_name: peer0.agridepart.zhaowu.com
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.agridepart.zhaowu.com
      - CORE_PEER_ADDRESS=peer0.agridepart.zhaowu.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.agridepart.zhaowu.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.agridepart.zhaowu.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.agridepart.zhaowu.com:7051
      - CORE_PEER_LOCALMSPID=AgridepartMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:9443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer0.agridepart.zhaowu.com:/var/hyperledger/production
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      
  peer1.agridepart.zhaowu.com:
    container_name: peer1.agridepart.zhaowu.com
    image: hyperledger/fabric-peer
    restart: always
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer1.agridepart.zhaowu.com
      - CORE_PEER_ADDRESS=peer1.agridepart.zhaowu.com:8051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:8051
      - CORE_PEER_CHAINCODEADDRESS=peer1.agridepart.zhaowu.com:8052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.agridepart.zhaowu.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.agridepart.zhaowu.com:8051
      - CORE_PEER_LOCALMSPID=AgridepartMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:10443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/peers/peer1.agridepart.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/agridepart.zhaowu.com/peers/peer1.agridepart.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer1.agridepart.zhaowu.com:/var/hyperledger/production
    ports:
      - 8051:8051
      - 8052:8052
      - 8053:8053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  cli1:
    container_name: cli1
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - 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=peer0.agridepart.zhaowu.com:7051
      - CORE_PEER_LOCALMSPID=AgridepartMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer0.agridepart.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/users/Admin@agridepart.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

  cli2:
    container_name: cli2
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli2
      - CORE_PEER_ADDRESS=peer1.agridepart.zhaowu.com:8051
      - CORE_PEER_LOCALMSPID=AgridepartMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer1.agridepart.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer1.agridepart.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/peers/peer1.agridepart.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agridepart.zhaowu.com/users/Admin@agridepart.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

3.2组织2及order2的docker-compose文件

在cd ~/sdk/go/multiple-deployment1目录下新建docker-compose.yaml

version: '2'

services:
  ca.agrimacowner.zhaowu.com:
    container_name: ca.agrimacowner.zhaowu.com
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca.agrimacowner.zhaowu.com
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.agrimacowner.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/priv_sk
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.agrimacowner.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/priv_sk
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/ca
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls
    ports:
      - "17054:7054"

  agrimacownerorderer.zhaowu.com:
    container_name: agrimacownerorderer.zhaowu.com
    image: hyperledger/fabric-orderer
    environment:
      - FABRIC_LOGGING_SPEC=DEBUG
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
      - ORDERER_GENERAL_BOOTSTRAPFILE=/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_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]
      - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:8443
      - ORDERER_METRICS_PROVIDER=prometheus
    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/zhaowu.com/orderers/agrimacownerorderer.zhaowu.com/msp:/var/hyperledger/orderer/msp
        - ./crypto-config/ordererOrganizations/zhaowu.com/orderers/agrimacownerorderer.zhaowu.com/tls/:/var/hyperledger/orderer/tls
        - ./data/agrimacownerorderer.zhaowu.com:/var/hyperledger/production
    ports:
      - 17050:7050
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  peer0.agrimacowner.zhaowu.com:
    container_name: peer0.agrimacowner.zhaowu.com
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.agrimacowner.zhaowu.com
      - CORE_PEER_ADDRESS=peer0.agrimacowner.zhaowu.com:17051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:17051
      - CORE_PEER_CHAINCODEADDRESS=peer0.agrimacowner.zhaowu.com:17052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:17052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.agrimacowner.zhaowu.com:17051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.agrimacowner.zhaowu.com:17051
      - CORE_PEER_LOCALMSPID=AgrimacownerMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:11443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer0.agrimacowner.zhaowu.com:/var/hyperledger/production
    ports:
      - 17051:17051
      - 17052:17052
      - 17053:17053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      
  peer1.agrimacowner.zhaowu.com:
    container_name: peer1.agrimacowner.zhaowu.com
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer1.agrimacowner.zhaowu.com
      - CORE_PEER_ADDRESS=peer1.agrimacowner.zhaowu.com:18051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:18051
      - CORE_PEER_CHAINCODEADDRESS=peer1.agrimacowner.zhaowu.com:18052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:18052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.agrimacowner.zhaowu.com:18051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.agrimacowner.zhaowu.com:18051
      - CORE_PEER_LOCALMSPID=AgrimacownerMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:12443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/peers/peer1.agrimacowner.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/agrimacowner.zhaowu.com/peers/peer1.agrimacowner.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer1.agrimacowner.zhaowu.com:/var/hyperledger/production
    ports:
      - 18051:18051
      - 18052:18052
      - 18053:18053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  cli3:
    container_name: cli3
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli3
      - CORE_PEER_ADDRESS=peer0.agrimacowner.zhaowu.com:17051
      - CORE_PEER_LOCALMSPID=AgrimacownerMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer0.agrimacowner.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/users/Admin@agrimacowner.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

  cli4:
    container_name: cli4
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli4
      - CORE_PEER_ADDRESS=peer1.agrimacowner.zhaowu.com:18051
      - CORE_PEER_LOCALMSPID=AgrimacownerMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer1.agrimacowner.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer1.agrimacowner.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/peers/peer1.agrimacowner.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/agrimacowner.zhaowu.com/users/Admin@agrimacowner.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

3.2组织3及order3的docker-compose文件

在cd ~/sdk/go/multiple-deployment2目录下新建docker-compose.yaml

version: '2'

services:
  ca.financedepart.zhaowu.com:
    container_name: ca.financedepart.zhaowu.com
    image: hyperledger/fabric-ca
    environment:
      - FABRIC_CA_HOME=/etc/hyperledger/fabric-ca-server
      - FABRIC_CA_SERVER_CA_NAME=ca.financedepart.zhaowu.com
      - FABRIC_CA_SERVER_CA_CERTFILE=/etc/hyperledger/fabric-ca-server-config/ca.financedepart.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_CA_KEYFILE=/etc/hyperledger/fabric-ca-server-config/priv_sk
      - FABRIC_CA_SERVER_TLS_ENABLED=true
      - FABRIC_CA_SERVER_TLS_CERTFILE=/etc/hyperledger/fabric-ca-server-tls/tlsca.financedepart.zhaowu.com-cert.pem
      - FABRIC_CA_SERVER_TLS_KEYFILE=/etc/hyperledger/fabric-ca-server-tls/priv_sk
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/ca
    command: sh -c 'fabric-ca-server start -b admin:adminpw -d'
    volumes:
      - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/ca/:/etc/hyperledger/fabric-ca-server-config
      - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/tlsca/:/etc/hyperledger/fabric-ca-server-tls
    ports:
      - "27054:7054"

  financedepartorderer.zhaowu.com:
    container_name: financedepartorderer.zhaowu.com
    image: hyperledger/fabric-orderer
    environment:
      - FABRIC_LOGGING_SPEC=DEBUG
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_BOOTSTRAPMETHOD=file
      - ORDERER_GENERAL_BOOTSTRAPFILE=/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_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]
      - ORDERER_OPERATIONS_LISTENADDRESS=0.0.0.0:13443
      - ORDERER_METRICS_PROVIDER=prometheus
    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/zhaowu.com/orderers/financedepartorderer.zhaowu.com/msp:/var/hyperledger/orderer/msp
        - ./crypto-config/ordererOrganizations/zhaowu.com/orderers/financedepartorderer.zhaowu.com/tls/:/var/hyperledger/orderer/tls
        - ./data/financedepartorderer.zhaowu.com:/var/hyperledger/production
    ports:
      - 27050:7050
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  peer0.financedepart.zhaowu.com:
    container_name: peer0.financedepart.zhaowu.com
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.financedepart.zhaowu.com
      - CORE_PEER_ADDRESS=peer0.financedepart.zhaowu.com:27051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:27051
      - CORE_PEER_CHAINCODEADDRESS=peer0.financedepart.zhaowu.com:27052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:27052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.financedepart.zhaowu.com:27051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.financedepart.zhaowu.com:27051
      - CORE_PEER_LOCALMSPID=FinancedepartMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:14443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer0.financedepart.zhaowu.com:/var/hyperledger/production
    ports:
      - 27051:27051
      - 27052:27052
      - 27053:27053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      
  peer1.financedepart.zhaowu.com:
    container_name: peer1.financedepart.zhaowu.com
    image: hyperledger/fabric-peer
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer1.financedepart.zhaowu.com
      - CORE_PEER_ADDRESS=peer1.financedepart.zhaowu.com:28051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:28051
      - CORE_PEER_CHAINCODEADDRESS=peer1.financedepart.zhaowu.com:28052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:28052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.financedepart.zhaowu.com:28051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.financedepart.zhaowu.com:28051
      - CORE_PEER_LOCALMSPID=FinancedepartMSP
      - FABRIC_LOGGING_SPEC=INFO
      - 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
      # Allow more time for chaincode container to build on install.
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
      - CORE_OPERATIONS_LISTENADDRESS=0.0.0.0:10443
      - CORE_METRICS_PROVIDER=prometheus
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
       - /var/run/:/host/var/run/
       - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/peers/peer1.financedepart.zhaowu.com/msp:/etc/hyperledger/fabric/msp
       - ./crypto-config/peerOrganizations/financedepart.zhaowu.com/peers/peer1.financedepart.zhaowu.com/tls:/etc/hyperledger/fabric/tls
       - ./data/peer1.financedepart.zhaowu.com:/var/hyperledger/production
    ports:
      - 28051:28051
      - 28052:28052
      - 28053:28053
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"

  cli5:
    container_name: cli5
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli5
      - CORE_PEER_ADDRESS=peer0.financedepart.zhaowu.com:27051
      - CORE_PEER_LOCALMSPID=FinancedepartMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer0.financedepart.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/users/Admin@financedepart.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

  cli6:
    container_name: cli6
    image: hyperledger/fabric-tools
    tty: true
    stdin_open: true
    environment:
      - GOPATH=/opt/gopath
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      #- FABRIC_LOGGING_SPEC=DEBUG
      - FABRIC_LOGGING_SPEC=INFO
      - CORE_PEER_ID=cli6
      - CORE_PEER_ADDRESS=peer1.financedepart.zhaowu.com:28051
      - CORE_PEER_LOCALMSPID=FinancedepartMSP
      - CORE_PEER_TLS_ENABLED=true
      - CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer1.financedepart.zhaowu.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer1.financedepart.zhaowu.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/peers/peer1.financedepart.zhaowu.com/tls/ca.crt
      - CORE_PEER_MSPCONfigPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/financedepart.zhaowu.com/users/Admin@financedepart.zhaowu.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/hyperledger/multiple-deployment/chaincode
        - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
        - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    extra_hosts:
      - "agridepartorderer.zhaowu.com:192.168.200.152"
      - "agrimacownerorderer.zhaowu.com:192.168.200.152"
      - "financedepartorderer.zhaowu.com:192.168.200.152"
      - "peer0.agridepart.zhaowu.com:192.168.200.152"
      - "peer1.agridepart.zhaowu.com:192.168.200.152"
      - "peer0.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer1.agrimacowner.zhaowu.com:192.168.200.152"
      - "peer0.financedepart.zhaowu.com:192.168.200.152"
      - "peer1.financedepart.zhaowu.com:192.168.200.152"

相关文章

显卡天梯图2024最新版,显卡是电脑进行图形处理的重要设备,...
初始化电脑时出现问题怎么办,可以使用win系统的安装介质,连...
todesk远程开机怎么设置,两台电脑要在同一局域网内,然后需...
油猴谷歌插件怎么安装,可以通过谷歌应用商店进行安装,需要...
虚拟内存这个名词想必很多人都听说过,我们在使用电脑的时候...