Hyperledger fabric 无法创建频道-试图包含不在联合体中的成员

Hyperledger fabric 无法创建频道-试图包含不在联合体中的成员,hyperledger-fabric,hyperledger,Hyperledger Fabric,Hyperledger,我面临一个关于创建频道的问题: 渠道1联盟-组织1、组织2、组织4、组织5 渠道2联盟-Org2、Org3、Org4、Org5 订购方创世联盟-Org1、Org2、Org3、Org4、Org5 从Cli对等(Org2)-当我尝试创建通道1或通道2时,我遇到以下问题: > peer channel create -o orderer.clm.com:7050 -c $CHANNEL_ONE_NAME -f ./channel-artifacts/channelone.tx --tls --c

我面临一个关于创建频道的问题:

渠道1联盟-组织1、组织2、组织4、组织5 渠道2联盟-Org2、Org3、Org4、Org5 订购方创世联盟-Org1、Org2、Org3、Org4、Org5

从Cli对等(Org2)-当我尝试创建通道1或通道2时,我遇到以下问题:

> peer channel create -o orderer.clm.com:7050 -c $CHANNEL_ONE_NAME -f ./channel-artifacts/channelone.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/clm.com/orderers/orderer.clm.com/msp/tlscacerts/tlsca.clm.com-cert.pem


2018-07-15 01:13:08.240 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser 
and orderer connections initialized
Error: got unexpected status: BAD_REQUEST -- Attempted to include a member 
which is not in the consortium
configtx.yaml文件

Organizations:
- &OrdererOrg
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: OrdererOrg

    # ID to load the MSP definition as
    ID: OrdererMSP

    # MSPDir is the filesystem path which contains the MSP configuration
    MSPDir: crypto-config/ordererOrganizations/clm.com/msp
    AdminPrincipal: Role.MEMBER

- &Org2
    Name: Bdc1MSP
    ID: Bdc1MSP
    MSPDir: crypto-config/peerOrganizations/bdc1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.bdc1.clm.com
          Port: 7051


- &Org1
    # DefaultOrg defines the organization which is used in the sampleconfig
    # of the fabric.git development environment
    Name: Cp1MSP

    # ID to load the MSP definition as
    ID: Cp1MSP

    MSPDir: crypto-config/peerOrganizations/cp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    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: peer0.cp1.clm.com
          Port: 7051

- &Org3
    Name: Adp1MSP
    ID: Adp1MSP
    MSPDir: crypto-config/peerOrganizations/adp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.adp1.clm.com
          Port: 7051
- &Org4
    Name: Ottp1MSP
    ID: Ottp1MSP
    MSPDir: crypto-config/peerOrganizations/ottp1.clm.com/msp
    AdminPrincipal: Role.MEMBER
    AnchorPeers:
        - Host: peer0.ottp1.clm.com
          Port: 7051
- &Org5
        Name: RegMSP
        ID: RegMSP
        MSPDir: crypto-config/peerOrganizations/reg.clm.com/msp
        AdminPrincipal: Role.MEMBER
        AnchorPeers:
            - Host: peer0.reg.clm.com
              Port: 7051
Capabilities:
    Global: &ChannelCapabilities
        V1_1: true
    Orderer: &OrdererCapabilities
        V1_1: true
    Application: &ApplicationCapabilities
        V1_2: true


Application: &ApplicationDefaults


    Organizations:


Orderer: &OrdererDefaults


OrdererType: solo

Addresses:
    - orderer.clm.com:7050

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


Profiles:

    FiveOrgsOrdererGenesis:
        Capabilities:
            <<: *ChannelCapabilities
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org2
                    - *Org1
                    - *Org3
                    - *Org4
                    - *Org5
    ChannelOne:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org2
                - *Org1
                - *Org5
                - *Org4
            Capabilities:
                <<: *ApplicationCapabilities
    ChannelTwo:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org2
                - *Org3
                - *Org5
                - *Org4
            Capabilities:
                <<: *ApplicationCapabilities
CLI容器中的环境变量:

root@6a67b1de8f57:/opt/gopath/src/github.com/hyperledger/fabric/peer# env
HOSTNAME=6a67b1de8f57
TERM=xterm





CORE_PEER_TLS_ROOTCERT_FILE=
/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/bdc1.clm.com/peers/
peer0.bdc1.clm.com/tls/ca.crt    
CORE_PEER_TLS_KEY_FILE=
/opt/gopath/src/github.com/hyperledger/fabric/peer/
crypto/peerOrganizations/bdc1.clm.com/peers/
peer0.bdc1.clm.com/tls/server.key
LS_COLORS=REMOVED
CORE_PEER_LOCALMSPID=Bdc1MSP
CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
CORE_PEER_TLS_CERT_FILE=/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/
bdc1.clm.com/peers/peer0.bdc1.clm.com/tls/server.crt
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
:/sbin:/bin:/opt/go/bin:/opt/gopath/bin
PWD=/opt/gopath/src/github.com/hyperledger/fabric/peer
CORE_PEER_TLS_ENABLED=true



CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/
fabric/peer/crypto/peerOrganizations/
bdc1.clm.com/users/Admin@bdc1.clm.com/msp    
CORE_PEER_ID=cli
SHLVL=1
HOME=/root
GOROOT=/opt/go
CORE_LOGGING_LEVEL=INFO
FABRIC_CFG_PATH=/etc/hyperledger/fabric
CORE_PEER_ADDRESS=peer0.bdc1.clm.com:7051
LESSOPEN=| /usr/bin/lesspipe %s
GOPATH=/opt/gopath
CHANNEL_ONE_NAME=channelone
LESSCLOSE=/usr/bin/lesspipe %s %s

_=/usr/bin/env

这通常发生在将不在联合体中的成员添加到频道时。 有关更多详细信息,请发布您的configtx.yaml

您可以参考此答案了解更多详细信息

编辑

在cli容器中检查您的环境:

$ env
然后检查这些变量是否正确导出,如果没有,请执行这些操作

export CORE_PEER_LOCALMSPID="Org2MSP"
export 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
export CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/org2.example.com/users/Admin@org2.example.com/msp
export CORE_PEER_ADDRESS=peer0.org2.example.com:7051
@阿纳布凯西 看起来好像关闭了docket容器,删除了卷和孤立项,已解决。
我重新创建了密码,通道伪影,解决了这个问题。不确定,我以前的作品是否与之有冲突。仍然不清楚,但已解决:)

在我的情况下,我忘记了导出频道名称:

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# echo $CHANNEL_NAME

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2018-12-07 18:07:18.375 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-07 18:07:18.636 UTC [common/tools/configtxgen/localconfig] Load -> INFO 002 Loaded configuration: /etc/hyperledger/fabric/configtx.yaml
Error: got unexpected status: BAD_REQUEST -- Attempted to include a member which is not in the consortium
导出后:

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2018-12-07 18:03:29.985 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-07 18:03:30.028 UTC [cli/common] readBlock -> INFO 002 Received block: 0

创建新频道时,我在Node SDK中遇到此错误。
每当我们更新联合体时,我们必须为渠道生成新的交易文件

在我的例子中,我忘记生成相应的一个,因此得到了错误。
我生成了一个新的事务文件
mychannel.tx


它解决了我的问题。

我今天也面临同样的问题。过了一会儿,我发现了为什么会发生这种情况。结果表明,如果channelXXXXXX.tx和anchorXXXX.tx文件不在同一文件夹中,即使您所做的一切都是正确的,这也会出错,因为它无法链接到锚节点

在我的例子中,我用各自的文件夹定义了多个通道。我犯了一个错误,将channelXXXXXX.tx放在了它的文件夹之外,并得到了错误


添加了config.tx yaml示例。我觉得不错。您用来创建频道的命令是什么?上面已经提到了..在这里也粘贴对等频道create-o order.clm.com:7050-c$channel\u ONE\u NAME-f./channel artifacts/channelone.tx--tls--cafile/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderorganizations/clm.com/orders/order.clm.com/msp/tlscacerts/tlsca.clm.com-cert.pem还尝试了导出全局变量,尝试了Org2、Org5、Org4,它们都是联合体的一部分:(请粘贴全局变量导出。这是隐式的。您需要注意这些事情。
root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# export CHANNEL_NAME=mychannel

root@e8daa001f461:/opt/gopath/src/github.com/hyperledger/fabric/peer# peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
2018-12-07 18:03:29.985 UTC [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized
2018-12-07 18:03:30.028 UTC [cli/common] readBlock -> INFO 002 Received block: 0