在Hyperledger Fabric 1.4中配置多个联盟

问题描述

在结构样本中,为两个组织定义了联盟,并且在configtx.yaml文件中为单个联盟 Consortium: SampleConsortium提供了文件

我尝试配置两个财团XYZCosortium和PQRConsortium。 配置文件定义如下:

  MultiNodeEtcdRaft:
       <<: *ChannelDefaults
       Capabilities:
           <<: *ChannelCapabilities
       Orderer:
           <<: *OrdererDefaults
           OrdererType: etcdraft
           EtcdRaft:
               Consenters:
               - Host: orderer1.xyz.com
                 Port: 7050
                 ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer1.xyz.com/tls/server.crt
                 ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer1.xyz.com/tls/server.crt
              
               - Host: orderer2.xyz.com
                 Port: 7050
                 ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer2.xyz.com/tls/server.crt
                 ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer2.xyz.com/tls/server.crt
 
               - Host: orderer3.xyz.com
                 Port: 7050
                 ClientTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer3.xyz.com/tls/server.crt
                 ServerTLSCert: crypto-config/ordererOrganizations/xyz.com/orderers/orderer3.xyz.com/tls/server.crt
 
               - Host: orderer1.pqr.com
                 Port: 7050
                 ClientTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer1.pqr.com/tls/server.crt
                 ServerTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer1.pqr.com/tls/server.crt
 
               - Host: orderer2.pqr.com
                 Port: 7050
                 ClientTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer2.pqr.com/tls/server.crt
                 ServerTLSCert: crypto-config/ordererOrganizations/pqr.com/orderers/orderer2.pqr.com/tls/server.crt
 
 
           Addresses:
               - orderer1.xyz.com:7050
               - orderer2.xyz.com:7050
               - orderer3.xyz.com:7050
               - orderer1.pqr.com:7050
               - orderer2.pqr.com:7050
 
 
           Organizations:
           - *OrdererOrg
           - *Orderer2Org
           Capabilities:
               <<: *OrdererCapabilities
       Application:
           <<: *ApplicationDefaults
           Organizations:
           - <<: *OrdererOrg
           - <<: *Orderer2Org
       Consortiums:
           XYZConsortium:
               Organizations:
               - *Org1
           PQRConsortium:
               Organizations:
               - *Org2
  

这是两个联合体,每个都有一个组织和相应的订购者,如上面订购者资料中所定义。

我也遇到了MSP相关问题,身份问题以及其他问题。我的问题是,

织物1.4可以配置多个财团吗?
如何在Fabric中配置多个联盟?

解决方法

使用结构1.4可以配置多个财团。

要在Fabric中配置多个联盟,必须正确编写configtx.yaml文件,尤其是配置文件

个人资料:

OrgsChannel1:
    Consortium: Consortium1
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org2
            - *Org3
        Capabilities:
            <<: *ApplicationCapabilities

OrgsChannel2:
    Consortium: Consortium2
    <<: *ChannelDefaults
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org3
            - *Org4
        Capabilities:
            <<: *ApplicationCapabilities

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: 8050
              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: 9050
              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: 10050
              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: 11050
              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:8050
            - orderer3.example.com:9050
            - orderer4.example.com:10050
            - orderer5.example.com:11050

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

        Consortium2:
            Organizations:
            - *Org3
            - *Org4