无法创建频道-试图包括联盟以外的成员

时间:2018-07-15 02:31:59

标签: hyperledger-fabric hyperledger

我在创建频道时遇到问题:

渠道1联盟-组织1,组织2,组织4,组织5 渠道2联盟-Org2,Org3,Org4,Org5 Orderer Genesis联盟-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

docker compos cli

cli:
container_name: cli
image: hyperledger/fabric-tools:$IMAGE_TAG
tty: true
stdin_open: true
environment:
  - GOPATH=/opt/gopath
  - CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
  #- CORE_LOGGING_LEVEL=DEBUG
  - CORE_LOGGING_LEVEL=INFO
  - CORE_PEER_ID=cli
  - CORE_PEER_ADDRESS=peer0.bdc1.clm.com:7051
  - CORE_PEER_LOCALMSPID=Bdc1MSP
  - CORE_PEER_TLS_ENABLED=true
  - 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
  - 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
  - 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_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/bdc1.clm.com/users/Admin@bdc1.clm.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/chaincode
    - ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
    - ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
    - ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
depends_on:
  - orderer.clm.com
  - peer0.bdc1.clm.com
networks:
  - byfn

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

5 个答案:

答案 0 :(得分:2)

就我而言,我忘记了public class UserApplication extends SwaggerApplication { @Override public Restlet createInboundRoot() { Router rootRouter2 = new Router(getContext()); rootRouter2.attach(getUserRouterName, UserRest.class); rootRouter2.setDefaultMatchingMode(Template.MODE_STARTS_WITH); rootRouter2.setRoutingMode(Router.MODE_LAST_MATCH); attachSwaggerSpecificationRestlet(rootRouter2, "/api-doc"); // Protect the set of resources ChallengeAuthenticator authenticatior = createAuthenticator(); authenticatior.setNext(rootRouter2); return authenticatior; } }

404 not found

导出后:

rarpa() {
  local idx s=${1//:}
  for (( idx=${#s} - 1; idx>=0; idx-- )); do
    printf '%s.' "${s:$idx:1}"
  done
  printf 'ip6.arpa\n'
}

rarpa '2001:0abc:0000:0000:0000:0000:0000:0001'

答案 1 :(得分:1)

我今天也面临同样的问题。一段时间后,我发现了为什么会这样。原来,如果channelXXXXXX.tx和anchorXXXX.tx文件不在同一个文件夹中,即使您所做的所有操作都是正确的,因为它无法链接到锚点对等点,也会出错。

就我而言,我有多个使用各自文件夹定义的频道。我犯了一个错误的将channelXXXXXX.tx放置在其文件夹外的错误。

here

答案 2 :(得分:0)

通常在联盟中没有成员时将其添加到通道中。 请发布您的configtx.yaml以获取更多详细信息。

您可以参考此答案以获取更多详细信息。

How can I add two orderers to the same channel?

编辑

在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

答案 3 :(得分:0)

@arnabkaycee 看起来像关闭卷宗容器并移除卷和孤立孤岛一样,已解决。 我重新创建了加密货币,再次创建了通道伪像,从而解决了它。不知道我以前的工作是否与之冲突。仍然一无所知,但已解决:)

答案 4 :(得分:0)

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

在我的情况下,我忘记生成相应的代码,因此出现了错误。
我生成了一个新的交易文件mychannel.tx

它解决了我的问题。