configtxgen失败:ERRO 003找不到配置文件

时间:2019-08-07 21:04:45

标签: hyperledger-fabric hyperledger

因此,我尝试使用一些自定义对等/组织来启动/引导Hyperledger Fabric网络,而我的configtx.yaml看起来像这样:

Organizations:

    - &orderer
        Name: orderer
        ID: ordererMsp
        MSPDir: crypto-config/ordererOrganizations/orderer/msp
        #For now I keep the basic/default policies here, we need to find out what is needed later.
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('ordererMsp.member')"
            Writers:
                Type: Signature
                Rule: "OR('ordererMsp.member')"
            Admins:
                Type: Signature
                Rule: "OR('ordererMsp.admin')"
    - &org1
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: org1

        # ID to load the MSP definition as
        ID: org1_MSP

        MSPDir: crypto-config/peerOrganizations/org1/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('org1_MSP.admin', 'org1_MSP.peer', 'org1_MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('org1_MSP.admin', 'org1_MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('org1_MSP.admin')"

        # leave this flag set to true.
        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: ANCHOR_HOST
              Port: 1000
    - &org2
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: org2

        # ID to load the MSP definition as
        ID: org2_MSP

        MSPDir: crypto-config/peerOrganizations/org2/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('org2_MSP.admin', 'org2_MSP.peer', 'org2_MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('org2_MSP.admin', 'org2_MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('org2_MSP.admin')"

        # leave this flag set to true.
        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: ANCHOR_HOST
              Port: 1000
    - &org3
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: org3

        # ID to load the MSP definition as
        ID: org3_MSP

        MSPDir: crypto-config/peerOrganizations/org3/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('org3_MSP.admin', 'org3_MSP.peer', 'org3_MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('org3_MSP.admin', 'org3_MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('org3_MSP.admin')"

        # leave this flag set to true.
        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: ANCHOR_HOST
              Port: 1000
    - &org4
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: org4

        # ID to load the MSP definition as
        ID: org4_MSP

        MSPDir: crypto-config/peerOrganizations/org4/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('org4_MSP.admin', 'org4_MSP.peer', 'org4_MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('org4_MSP.admin', 'org4_MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('org4_MSP.admin')"

        # leave this flag set to true.
        AnchorPeers:
            # AnchorPeers defines the location of peers which can be used
            # for cross org gossip communication.  Note, this value is only
            # encoded in the genesis block in the Application section context
            - Host: ANCHOR_HOST
              Port: 1000
---
Capabilities:
    # Channel capabilities apply to both the orderers and the peers and must be
    # supported by both.
    # Set the value of the capability to true to require it.
    Channel: &ChannelCapabilities
        # V1.4.2 for Channel is a catchall flag for behavior which has been
        # determined to be desired for all orderers and peers running at the v1.4.2
        # level, but which would be incompatible with orderers and peers from
        # prior releases.
        # Prior to enabling V1.4.2 channel capabilities, ensure that all
        # orderers and peers on a channel are at v1.4.2 or later.
        V1_4_2: true

    # Orderer capabilities apply only to the orderers, and may be safely
    # used with prior release peers.
    # Set the value of the capability to true to require it.
    Orderer: &OrdererCapabilities
        # V1.4.2 for Orderer is a catchall flag for behavior which has been
        # determined to be desired for all orderers running at the v1.4.2
        # level, but which would be incompatible with orderers from prior releases.
        # Prior to enabling V1.4.2 orderer capabilities, ensure that all
        # orderers on a channel are at v1.4.2 or later.
        V1_4_2: true

    # Application capabilities apply only to the peer network, and may be safely
    # used with prior release orderers.
    # Set the value of the capability to true to require it.
    Application: &ApplicationCapabilities
        # V1.4.2 for Application enables the new non-backwards compatible
        # features and fixes of fabric v1.4.2.
        V1_4_2: true
        # V1.3 for Application enables the new non-backwards compatible
        # features and fixes of fabric v1.3.
        V1_3: false
        # V1.2 for Application enables the new non-backwards compatible
        # features and fixes of fabric v1.2 (note, this need not be set if
        # later version capabilities are set)
        V1_2: false
        # V1.1 for Application enables the new non-backwards compatible
        # features and fixes of fabric v1.1 (note, this need not be set if
        # later version capabilities are set).
        V1_1: false
---
Application: &ApplicationDefaults

    # Organizations is the list of orgs which are defined as participants on
    # the application side of the network
    Organizations:

    # Policies defines the set of policies at this level of the config tree
    # For Application policies, their canonical path is
    #   /Channel/Application/<PolicyName>
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    Capabilities:
        <<: *ApplicationCapabilities
Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo" and "kafka"
    OrdererType: solo

    Addresses:
        - orderer_orderer.com:6000

    # 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:

        # Max Message Count: The maximum number of messages to permit in a batch
        MaxMessageCount: 10

        # Absolute Max Bytes: The absolute maximum number of bytes allowed for
        # the serialized messages in a batch.
        AbsoluteMaxBytes: 99 MB

        # Preferred Max Bytes: The preferred maximum number of bytes allowed for
        # the serialized messages in a batch. A message larger than the preferred
        # max bytes will result in a batch larger than preferred max bytes.
        PreferredMaxBytes: 512 KB

    Kafka:
        # Brokers: A list of Kafka brokers to which the orderer connects
        # NOTE: Use IP:port notation
        Brokers:
            - 127.0.0.1:9092

    # Organizations is the list of orgs which are defined as participants on
    # the orderer side of the network
    Organizations:

    # Policies defines the set of policies at this level of the config tree
    # For Orderer policies, their canonical path is
    #   /Channel/Orderer/<PolicyName>
    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 defines the set of policies at this level of the config tree
    # For Channel policies, their canonical path is
    #   /Channel/<PolicyName>
    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 describes the channel level capabilities, see the
    # dedicated Capabilities section elsewhere in this file for a full
    # description
    Capabilities:
        <<: *ChannelCapabilities
---
Profiles:
    DefaultOrgsChannelGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *orderer
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *org1
                    - *org2
                    - *org3
                    - *org4
    DefaultOrgsChannel:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *org1
                - *org2
                - *org3
                - *org4
            Capabilities:
                <<: *ApplicationCapabilities

当我尝试像这样运行configtxgen时:

  

configtxgen -configPath ./generation/configtx -profile DefaultOrgsChannelGenesis -channelID $ SYS_CHANNEL -outputBlock ./channel-artifacts/genesis.block

我收到此错误:

2019-08-07 22:57:12.650 CEST [common.tools.configtxgen] main-> INFO 001正在加载配置 2019-08-07 22:57:12.653 CEST [common.tools.configtxgen.localconfig]加载-> PANI 002找不到配置文件:DefaultOrgsChannelGenesis 2019-08-07 22:57:12.653 CEST [common.tools.configtxgen] func1-> ERRO 003找不到配置文件:DefaultOrgsChannelGenesis。请确保将FABRIC_CFG_PATH或-configPath设置为包含具有指定配置文件的configtx.yaml的路径

任何想法,我都困在那儿:/我仔细检查了压痕,对我来说看起来还不错...但是谁知道也许我是盲目的

编辑:因此,我用第一个网络示例中给出的示例替换了configtx.yaml的内容,并且在那里工作。因此,它一定是我自己的yaml版本中的某个内容,但我无法弄清楚:x格式化文件不能解决问题,某些键/值不正确?

1 个答案:

答案 0 :(得分:0)

看着错误,它要求在您的shell中的FABRIC_CFG_PATH中设置configPathconfigtx.yaml

执行以下操作:

export FABRIC_CFG_PATH = path_to_your_configtx.yaml