Hyperledger Fabric配置文件解析

2023-11-17

1、相关配置文件介绍

crypto-config.yaml:用于配置网络中的加密材料,例如证书、密钥等。该文件定义了组织、节点和用户的证书和私钥的存储位置、命名规则和类型等信息。这个文件是在启动网络之前必须要有的配置文件。


configtx.yaml :用于配置Fabric的创世区块和通道,包括定义组织、节点、策略、订购服务等信息。该文件定义了网络中的所有参与方的身份和角色,以及它们之间的关系和交互。此外,configtx.yaml还包括定义通道的策略、背书策略等信息。


docker-compose.yaml:用以配置fabric网络的相关容器



orderer.yaml:用于配置Orderer节点,例如定义共识类型、监听地址、TLS设置等信息。该文件定义了Orderer节点的角色和功能,包括共识机制、共识协议、共识节点之间的通信等信息。


core.yaml:用于配置Peer节点的行为,例如定义Peer节点如何连接到网络,定义背书和验证策略等信息。该文件定义了Peer节点的角色和功能,包括链码的背书和查询、事件订阅和传输、链码生命周期管理等信息。


core.yaml和orderer.yaml配置文件的位置通常会被打包在docker镜像中,而不是直接提供给用户查看和编辑。如果你需要自定义这些配置文件,可以通过构建自己的docker镜像并将其作为替换添加到test-network中。另外,你也可以通过在启动peer和orderer容器时使用-v参数挂载主机目录来替换默认的配置文件。

2、crypto-config.yaml

OrdererOrgs:						## 定义管理orderer节点的组织
  - Name: Orderer					## 这个组织的名字叫 Orderer
    Domain: example.com				## 这个组织的域名是 example.com 
    
    # 生成证书的时候,证书内会包含Name和Domain信息,orderer.example.com就是这个组织的地址
    
    EnableNodeOUs: true		## 启用了 EnableNodeOUs 后,会在 MSP 目录下生成 config.yaml 文件,该文件包含了组织单元(OU)的相关配置信息,例如节点 OU 和客户端 OU 的组织单元标识符(OU Identifier)和证书。这些信息可以用于定义节点和客户端的身份验证策略。
    # 如果启用了这个选项,那么节点的证书将会包含其所属的OU标识。这个选项在配置节点的MSP(成员服务提供程序)时使用,以便正确识别并验证节点的证书。具体来说,在节点的MSP配置中,可以指定一个或多个OU标识,并为每个标识提供相应的TLS和签名证书。然后,节点的证书可以将其所属的OU标识包含在内,以便在验证时正确识别节点。启用节点OU对于在Fabric网络中进行身份验证和授权非常重要。
    # 如果不启用该选项,则节点的证书只会包含其所属的组织信息,而无法确定该节点属于哪个OU,这可能会导致网络安全问题。
    
    # 对于一个Spec来说,配置了CommonName,那么文件夹则命名为CommonName
    # 如果没有配置CommonName,则文件名为:{{.Hostname}}.{{Domain}}
    # 在下面的例子中,在 crypto-config/ordererOrganizations/example.com/orderers 目录下
    # 则会产生两个文件orderer.test.com和orderer5.test.com,
    # 如果没有加CommonName,则目录名为order.example.com与order5.example.comn

    #   - SANS:       (Optional) Specifies one or more Subject Alternative Names
    #                 to be set in the resulting x509. Accepts template
    #                 variables {{.Hostname}}, {{.Domain}}, {{.CommonName}}. IP
    #                 addresses provided here will be properly recognized. Other
    #                 values will be taken as DNS names.
    #                 NOTE: Two implicit entries are created for you:
    #                     - {{ .CommonName }}
    #                     - {{ .Hostname }}
    Specs:
      - Hostname: orderer
        CommonName: orderer.test.com
        SANS:
          - localhost  #此处提供的地址将被正确识别。另外值将作为DNS名称解析。
      # - Hostname: orderer2
      # - Hostname: orderer3
      # - Hostname: orderer4
      - Hostname: orderer5
        CommonName: orderer5.test.com

PeerOrgs:											## 定义管理peer节点的组织
  - Name: Org1								
    Domain: org1.example.com	
    EnableNodeOUs: true
  	
  	# Template是按照Template模板生成多个文件,数量由Count决定,起始编号由Start决定
  	# 如下配置会在crypto-config/peerOrganizations/org1.example.com/peers目录下,
  	# 生成两个文件,分别是 peer0.org1.example.com 和 peer1.org1.example.com
  	# 如果把Start注释去掉,那么会生成 peer5.org1.example.com 和 peer6.org1.example.com
    Template:
      Count: 2
      # Start: 5
      
    # Users是生成除了Admin之外多少个user,数量由Count决定
    # 对于orderer组织,这个值设置了也没有效果
    # 如果配置会在crypto-config/peerOrganizations/org1.example.com/users目录下,
    # 生成两个文件,分别是Admin@org1.example.com和User1@org1.example.com
    # 如果改为2,那么会多一个User2@org1.example.com
    Users:
      Count: 1
	
		# 如下如果在这里加入一个Specs,那么会在peers目录下生成3个文件了
		# 包括,peer0.org2.example.com, peer1.org2.example.com 和 test.org2.example.com
  - Name: Org2
    Domain: org2.example.com
    EnableNodeOUs: true
    # Specs:
    #  - Hostname: test
    Template:
      Count: 2
    Users:
      Count: 1

3、configtx.yaml

3.1 Organizations组织配置部分

Organizations配置段用来定义组织机构实体,以便在后续配置中引用

Organizations:
    - &OrdererOrg
        Name: OrdererOrg	## 组织名称
        ID: OrdererMSP	## 组织IDID是引用组织的关键
        MSPDir: crypto-config/ordererOrganizations/example.com/msp	## 组织的MSP证书路径
        ## 定义本层级的组织策略,其权威路径为 /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"

    - &Org1
        Name: Org1MSP
        ID: Org1MSP
        MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org1MSP.admin')"
        AnchorPeers:		## 定义组织的锚节点
            - Host: peer0.org1.example.com		## 锚节点的host地址
              Port: 7051	## 锚节点开放的端口号

    - &Org2
        Name: Org2MSP
        ID: Org2MSP
        MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org2MSP.admin')"
        AnchorPeers:	
            - Host: peer0.org2.example.com
              Port: 9051

3.2 Capabilities通道能力配置部分

Capabilities 段用来定义fabric网络的能力。这是版本v1.1.0引入的一个新的配置段,当与版本v1.0.x的orderer节点与peer节点混合组网时不可使用。

Capabilities:
		# Channel配置同时应用于orderer节点与peer节点,并且必须被两种节点同时支持
    # 将该配置项设置为ture表明要求节点具备该能力,false则不要求该节点具备该能力
    Channel: &ChannelCapabilities
        V1_4_3: true    
        V1_3: false 
        V1_1: false
    # Orderer功能仅适用于orderers,可以安全地操作,而无需担心升级peers
    # 将该配置项设置为ture表明要求节点具备该能力,false则不要求该节点具备该能力
    Orderer: &OrdererCapabilities
        V1_4_2: true 
        V1_1: false
    # 应用程序功能仅适用于Peer网络,可以安全地操作,而无需担心升级或更新orderers
    # 将该配置项设置为ture表明要求节点具备该能力,false则不要求该节点具备该能力
    Application: &ApplicationCapabilities
        V1_4_2: true
        V1_3: false
        V1_2: false  
        V1_1: false

3.3 Application 应用通道相关配置

Application配置段用来定义要写入创世区块或配置交易的应用参数

Application: &ApplicationDefaults  ##  自定义被引用的地址
    Organizations:	## Organizations配置列出参与到网络中的机构清单
    Policies:		## 定义本层级的应用控制策略,其权威路径为 /Channel/Application/<PolicyName>
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
    # Capabilities配置描述应用层级的能力需求,这里直接引用
    # 前面Capabilities配置段中的ApplicationCapabilities配置项
    Capabilities:
        <<: *ApplicationCapabilities

3.4 Orderer 排序节点配置

Orderer配置段用来定义要编码写入创世区块或通道交易的排序节点参数

Orderer: &OrdererDefaults
		# 排序节点类型用来指定要启用的排序节点实现,不同的实现对应不同的共识算法。
    # 目前可用的类型为:solo,kafka,EtcdRaft
    OrdererType: solo
    Addresses:		## 服务地址,这个地方很重要,一定要配正确
        - orderer.example.com:7050
    BatchTimeout: 2s	## 区块打包的最大超时时间 (到了该时间就打包区块)
    BatchSize:	## 区块打包的最大包含交易数(orderer端切分区块的参数)
        MaxMessageCount: 10	 				## 一个区块里最大的交易数
        AbsoluteMaxBytes: 99 MB			## 一个区块的最大字节数,任何时候都不能超过
        PreferredMaxBytes: 512 KB		## 一个区块的建议字节数,如果一个交易消息的大小超过了这个值, 就会被放入另外一个更大的区块中
    MaxChannels: 0    ## 【可选项】表示Orderer允许的最大通道数, 默认0表示没有最大通道数
    Kafka:
        Brokers:	## kafka模式的时候kafka节点的地址,通常至少配2- 127.0.0.1:9092
    EtcdRaft:	## 定义了EtcdRaft排序类型被选择时的配置
        Consenters:
            - Host: orderer.example.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
            - Host: orderer2.example.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
            - Host: orderer3.example.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
            - Host: orderer4.example.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
            - Host: orderer5.example.com
              Port: 7050
              ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
              ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
    Organizations:	 ## 参与维护Orderer的组织,默认为空
    # 定义本层级的排序节点策略,其权威路径为 /Channel/Orderer/<PolicyName>
    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"
    # Capabilities配置描述排序节点层级的能力需求,这里直接引用
    # 前面Capabilities配置段中的OrdererCapabilities配置项
    Capabilities:
        <<: *OrdererCapabilities

3.5 Channel 通道配置

Channel配置段用来定义要写入创世区块或配置交易的通道参数。

Channel: &ChannelDefaults
		# 定义本层级的通道访问策略,其权威路径为 /Channel/<PolicyName>
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Writes策略定义了调用Broadcast API提交交易的许可规则
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # Admin策略定义了修改本层级配置的许可规则
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
    # Capabilities配置描通道层级的能力需求,这里直接引用
    # 前面Capabilities配置段中的ChannelCapabilities配置项
    Capabilities:
        <<: *ChannelCapabilities

3.6 Profiles 配置入口

Profiles配置段用来定义用于configtxgen工具的配置入口。包含联盟(consortium)的配置入口可以用来生成排序节点的创世区块。

Profiles:
		# TwoOrgsOrdererGenesis用来生成orderer启动时所需的block,用于生成创世区块,名字可以任意
		# 需要包含Orderer和Consortiums两部分
    TwoOrgsOrdererGenesis:	
        <<: *ChannelDefaults	## 通道为默认配置,这里直接引用上面channel配置段中的ChannelDefaults
        Orderer:
            <<: *OrdererDefaults	## Orderer为默认配置,这里直接引用上面orderer配置段中的OrdererDefaults
            Organizations:	## 这里直接引用上面Organizations配置段中的OrdererOrg
                - *OrdererOrg	
            Capabilities:	## 这里直接引用上面Capabilities配置段中的OrdererCapabilities
                <<: *OrdererCapabilities
        # 联盟为默认的 SampleConsortium 联盟,添加了两个组织,表示orderer所服务的联盟列表
        Consortiums:	
            SampleConsortium:		##  创建更多应用通道时的联盟引用 TwoOrgsChannel 所示
                Organizations:
                    - *Org1
                    - *Org2
    # TwoOrgsChannel用来生成channel配置信息,名字可以任意
		# 需要包含Consortium和Applicatioon两部分。 
    TwoOrgsChannel:
        Consortium: SampleConsortium		## 通道所关联的联盟名称
        <<: *ChannelDefaults		## 通道为默认配置,这里直接引用上面channel配置段中的ChannelDefaults
        Application:
            <<: *ApplicationDefaults	## 这里直接引用上面Application配置段中的ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities	## 这里直接引用上面Capabilities配置段中的ApplicationCapabilities
                
		# SampleInsecureKafka定义了一个使用Kfaka排序节点的配置
    SampleDevModeKafka:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            OrdererType: kafka
            Kafka:
                Brokers:
                - kafka.example.com:9092

            Organizations:
            - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Application:
            <<: *ApplicationDefaults
            Organizations:
            - <<: *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                - *Org1
                - *Org2
		# SampleInsecureKafka定义了一个使用EtcdRaft排序节点的配置
    SampleMultiNodeEtcdRaft:
        <<: *ChannelDefaults
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            OrdererType: etcdraft
            EtcdRaft:
                Consenters:
                - Host: orderer.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
                - Host: orderer2.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/server.crt
                - Host: orderer3.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer3.example.com/tls/server.crt
                - Host: orderer4.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer4.example.com/tls/server.crt
                - Host: orderer5.example.com
                  Port: 7050
                  ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
                  ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer5.example.com/tls/server.crt
            Addresses:
                - orderer.example.com:7050
                - orderer2.example.com:7050
                - orderer3.example.com:7050
                - orderer4.example.com:7050
                - orderer5.example.com:7050

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

4、docker-compose.yaml

version: '2'

volumes:
  orderer0.example.com:
  orderer1.example.com:
  orderer2.example.com:
  peer0.org1.example.com:
  peer1.org1.example.com:
  peer0.org2.example.com:
  peer1.org2.example.com:
  
  
networks:
  testwork:
  
services:
  orderer0.example.com:
    container_name: orderer0.example.com
    image: hyperledger/fabric-orderer:latest
    environment:
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=5050
      - 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]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer
    volumes:
      - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer0.example.com/tls/:/var/hyperledger/orderer/tls
      - orderer0.example.com:/var/hyperledger/production/orderer
    ports:
      - 5050:5050
    networks:
      - testwork
      
  orderer1.example.com:
    container_name: orderer1.example.com
    image: hyperledger/fabric-orderer:latest
    environment:
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=6050
      - 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]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer
    volumes:
      - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer1.example.com/tls/:/var/hyperledger/orderer/tls
      - orderer1.example.com:/var/hyperledger/production/orderer
    ports:
      - 6050:6050
    networks:
      - testwork
      
  orderer2.example.com:
    container_name: orderer2.example.com
    image: hyperledger/fabric-orderer:latest
    environment:
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=7050
      - 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]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer
    volumes:
      - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/msp:/var/hyperledger/orderer/msp
      - ./crypto-config/ordererOrganizations/example.com/orderers/orderer2.example.com/tls/:/var/hyperledger/orderer/tls
      - orderer2.example.com:/var/hyperledger/production/orderer
    ports:
      - 7050:7050
    networks:
      - testwork
      
  peer0.org1.example.com:
    container_name: peer0.org1.example.com
    image: hyperledger/fabric-peer:latest
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.org1.example.com
      - CORE_PEER_ADDRESS=peer0.org1.example.com:7051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org1.example.com:7052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org1.example.com:7051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org1.example.com:7051
      - CORE_PEER_LOCALMSPID=Org1MSP
      - 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
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls:/etc/hyperledger/fabric/tls
      - peer0.org1.example.com:/var/hyperledger/production
    ports:
      - 7051:7051
      - 7052:7052
      - 7053:7053
    networks:
      - testwork
      
  peer1.org1.example.com:
    container_name: peer1.org1.example.com
    image: hyperledger/fabric-peer:latest
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer1.org1.example.com
      - CORE_PEER_ADDRESS=peer1.org1.example.com:7061
      - CORE_PEER_LISTENADDRESS=0.0.0.0:7061
      - CORE_PEER_CHAINCODEADDRESS=peer1.org1.example.com:7062
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:7062
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org1.example.com:7061
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org1.example.com:7061
      - CORE_PEER_LOCALMSPID=Org1MSP
      - 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
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org1.example.com/peers/peer1.org1.example.com/tls:/etc/hyperledger/fabric/tls
      - peer1.org1.example.com:/var/hyperledger/production
    ports:
      - 7061:7061
      - 7062:7062
      - 7063:7063
    networks:
      - testwork

  
  peer0.org2.example.com:
    container_name: peer0.org2.example.com
    image: hyperledger/fabric-peer:latest
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer0.org2.example.com
      - CORE_PEER_ADDRESS=peer0.org2.example.com:8051
      - CORE_PEER_LISTENADDRESS=0.0.0.0:8051
      - CORE_PEER_CHAINCODEADDRESS=peer0.org2.example.com:8052
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8052
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer0.org2.example.com:8051
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer0.org2.example.com:8051
      - CORE_PEER_LOCALMSPID=Org2MSP
      - 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
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls:/etc/hyperledger/fabric/tls
      - peer0.org2.example.com:/var/hyperledger/production
    ports:
      - 8051:8051
      - 8052:8052
      - 8053:8053
    networks:
      - testwork 
      
  peer1.org2.example.com:
    container_name: peer1.org2.example.com
    image: hyperledger/fabric-peer:latest
    environment:
      - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
      - CORE_PEER_ID=peer1.org2.example.com
      - CORE_PEER_ADDRESS=peer1.org2.example.com:8061
      - CORE_PEER_LISTENADDRESS=0.0.0.0:8061
      - CORE_PEER_CHAINCODEADDRESS=peer1.org2.example.com:8062
      - CORE_PEER_CHAINCODELISTENADDRESS=0.0.0.0:8062
      - CORE_PEER_GOSSIP_BOOTSTRAP=peer1.org2.example.com:8061
      - CORE_PEER_GOSSIP_EXTERNALENDPOINT=peer1.org2.example.com:8061
      - CORE_PEER_LOCALMSPID=Org2MSP
      - 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
      - CORE_CHAINCODE_EXECUTETIMEOUT=300s
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: peer node start
    volumes:
      - /var/run/:/host/var/run/
      - ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/msp:/etc/hyperledger/fabric/msp
      - ./crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
      - peer1.org2.example.com:/var/hyperledger/production
    ports:
      - 8061:8061
      - 8062:8062
      - 8063:8063
    networks:
      - testwork 

  cli1:
    container_name: cli1
    image: hyperledger/fabric-tools:latest
    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.org1.example.com:7051
      - 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.example.com/peers/peer0.org1.example.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/multiple-deployment/chaincode/go
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    depends_on:
      - peer0.org1.example.com
      - peer0.org2.example.com
      - orderer0.example.com
      - orderer1.example.com
      - orderer2.example.com
    networks:
      - testwork
  
  cli2:
    container_name: cli2
    image: hyperledger/fabric-tools:latest
    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=peer0.org2.example.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.example.com/peers/peer0.org2.example.com/tls/server.crt
      - CORE_PEER_TLS_KEY_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/server.key
      - CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt
      - CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
    command: /bin/bash
    volumes:
      - /var/run/:/host/var/run/
      - ../chaincode/go/:/opt/gopath/src/github.com/hyperledger/multiple-deployment/chaincode/go
      - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
      - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
    depends_on:
      - peer0.org1.example.com
      - peer0.org2.example.com
      - orderer0.example.com
      - orderer1.example.com
      - orderer2.example.com
    networks:
      - testwork
 

参考链接: Hyperledger Fabric配置文件解析1
参考链接: Hyperledger Fabric配置文件解析2

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Hyperledger Fabric配置文件解析 的相关文章

随机推荐

  • 【人工智能】感知器算法的设计实现(QDU)

    人工智能 Astar算法求解8数码问题 QDU 人工智能 利用 搜索的博弈树算法编写一字棋游戏 QDU 人工智能 Fisher 线性分类器的设计与实现 QDU 人工智能 感知器算法的设计实现 QDU 人工智能 SVM 分类器的设计与应用 Q
  • Hive的数据类型

    Hive支持的数据类型如下 原生类型 TINYINT SMALLINT INT BIGINT BOOLEAN FLOAT DOUBLE STRING BINARY Hive 0 8 0以上才可用 TIMESTAMP Hive 0 8 0以上
  • 04-SpringBoot集成Nebula Graph

    SpringBoot集成Nebula 建议模块 在这里给大家推荐一种方式 每引入一种新的技术 建议新建一个模块 来适配这种技术 对外提供接口 在调用的地方应用就可以 不用搞的到处都是 防止如果后续替换这种技术 还要到处修改 这样的话 只需要
  • 工业大数据漫谈14:煤矿与非煤矿矿山如何应用大数据

    在工业领域 煤矿与非煤矿山属于相对特殊的行业 不是我们传统意义上的工厂模式 而是一种资源开采模式 矿山行业因为其生产的特殊性 因此在工业大数据的应用上 也呈现出了与制造型工业完全不同的特点 与制造型工业相比较 矿山行业最大的区别在于产品质量
  • JTest简单试用

    安装JTest 拷贝破解文件lic client jar到 Parasoft Test 9 4 plugins com parasoft xtest libs 9 4 0 20120412 Parasoft 创建附带案例 例如JPetSto
  • SpringBoot项目在IDEA制作Docker镜像并部署到阿里服务器运行

    SpringBoot项目如何在IDEA制作Docker镜像并部署到阿里服务器运行 首先IDEA安装Docker插件 没错就是它 这家伙挺好用的 安装后你会看到 这里就是配置你阿里云服务器地址的 服务器开放docker的2375端口还需要改配
  • Visual Studio error C2001:常量中有换行符

    问题描述 问题分析 经百度多方求助 发现该问题主要是由中文和文件编码格式引起的 存在中文时需要手动文件编码格式转换成UTF 8 这里使用Notepad 去转换 但是很奇怪的是我发现我的文件就是UTF 8的格式 仍然编译不过 我查询了其他没有
  • idea插件生成用例图、时序图、类图、活动图

    给大家推荐一个idea生成用例图 时序图等的神器 PlantUML 最近软件工程要结课了 结课报告要附加用例图 时序图 类图 活动图等 类图我首先就想到可以用idea生成 嘿嘿 可惜忘了怎么用 搜着搜着 突然发现 idea生成时序图 用例图
  • dfs、bfs时候染色算法和直接传一个visited两种方法

    以695 岛屿的最大面积为例 在图的遍历中 如果不加任何约束 DFS和BFS一定会遍历到重复节点 解决这个问题的一个方法就是在函数外定义一个visited set 然后每次遍历的时候把未在visited中的节点加入 在外面的递归终止条件 队
  • eclipse 项目没错却有红叉(解决办法)

    1 进入 eclipse 选择报错的项目 然后在工具栏选择Window 选择Show View 选择Problems 如下图 2 找到 General 下的 problems 双击 problems 就会在下面提示你项目报错的原因 根据错误
  • Go_异常处理

    Error 异常就是程序出现了不正常的情况 会导致程序非正常停止 而异常处理就是针对非正常停止的情况 给出异常时的处理方式 语法错误不算异常体系中 error是一个接口 作用是返回程序异常的信息 errors实现了error type er
  • QT踩坑第十一天(QT多线程)

    前言 QT在什么时候会用到多线程 所有的IO操作都要放到线程里面 1 IO操作QIODevice文件IO网络IO 套接字eg CAN Linux下也是套接字 串口等外设 因为他们不确定什么时候可以读完 2 耗时的算法eg 文件压缩 信号处理
  • Moviepy音视频开发:视频转gif动画或jpg图片exe图形化工具开发案例

    前往老猿Python博文目录 一 引言 老猿之所以学习和研究Moviepy的使用 是因为需要一个将视频转成动画的工具 当时在网上到处搜索查找免费使用工具 结果找了很多自称免费的工具 但转完GIF后都会在动画中打上对应工具的显著广告或Logo
  • 一周小结 - 拒绝拖延 现在做起

    很早就一直有用文字记录生活的想法 终于在这周开始了 不知道能写多久 拭目以待 一周的生活回顾下来 可能下面的一些让自己有些许感悟吧 感悟之一 更多的体验发现不一样的美好 感悟之二 有些事并没那么可怕 可怕的 可能是被头脑放大了N倍 感悟之三
  • 华为od机试 Python【扩散矩阵】

    描述 你手上有一个数字版的迷宫 里面只有两种格子 0 和 1 这里的1有个特性 它每秒会感染它上 下 左 右的0格子 一旦0被感染 它就变成1 给定一个迷宫大小以及两个起始感染点 你能算出这个迷宫被完全感染需要多少秒吗 输入 迷宫的行列数
  • mybatis-plus返回查询总记录数

    mybatis plus返回查询总记录数 mp框架提供了selectCount方法 来查询总记录数 需求 查找薪水大于3500 名字里有 小 的 员工的个数 sql实现 select count from t employee where
  • C++的基础学习

    C 主要学习 C与C 的不同 C 的特性及专业术语 C 程序的编译 一 C到C 的转换 C与C 的区别 C 是C的增强 区别 C 具有严格的数据类型检查 C 新增了命名空间 异常处理 面向对象编程 变量的权限和引用及函数的重载及运算符的重载
  • HTTP1.0和HTTP1.1和HTTP2.0的区别

    HTTP1 0和HTTP1 1和HTTP2 0的区别 1 HTTP1 0和HTTP1 1的区别 1 1 长连接 Persistent Connection HTTP1 1支持长连接和请求的流水线处理 在一个TCP连接上可以传送多个HTTP请
  • Mysql索引详解及优化(key和index区别)

    Mysql索引详解及优化 key和index区别 文章记录
  • Hyperledger Fabric配置文件解析

    目录 1 相关配置文件介绍 2 crypto config yaml 3 configtx yaml 3 1 Organizations组织配置部分 3 2 Capabilities通道能力配置部分 3 3 Application 应用通道