如何将两个订购者添加到同一频道?

时间:2018-06-29 10:22:02

标签: apache-kafka hyperledger-fabric channel

我正在尝试使用Kafka建立具有两个订单的网络。

在第一个网络示例中,有一个名为./script.sh的脚本,该脚本使用运行此命令的关联订购者创建了一个频道:

peer channel create -o orderer.example.com:7050 -c $CHANNEL_NAME -f ./channel-artifacts/channel.tx --tls true --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem >&log.txt

我已经开始实施Kafka。但是我的问题是如何更改此命令以创建具有两个订单的通道? 还是有更好的方法来做到这一点?

2 个答案:

答案 0 :(得分:1)

您不向频道添加订购者。 订购者属于订购者组织。您可以定义订购者组织可以服务的多个联盟。在订购者组织的定义内提供了联盟的定义。

创建频道时,可以定义该频道所属的联盟。您在渠道中定义的成员必须是该联盟的一部分。

因此,如果您定义了一个订购者组织,并且其中有多个订购者节点,它将通过联合体为该组织所属的所有渠道提供服务。

考虑以下configtx.yaml的简化示例:

ProfileForGenesisOrderer1:
    Orderer:
        Organizations:
            - *OrdererOrg1
    Consortiums:
        Consortium1:
            Organizations:
                - *Org1
                - *Org2
                - *Org3

ProfileForGenesisOrderer2:
    Orderer:
        Organizations:
            - *OrdererOrg2
    Consortiums:
        Consortium2:
            Organizations:
                - *Org4
                - *Org5
                - *Org6

ChannelOne:
    Consortium: Consortium1
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org3

ChannelOne:
    Consortium: Consortium2
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org6
            - *Org4

属于OrdererOrg1的订购者将仅其Consortium1因此服务ChannelOne。 OrdererOrg2也是如此。

答案 1 :(得分:0)

我也希望对不同的组织有不同的订单。我正在第一个网络上的configtx.yaml上尝试此操作

ProfileForGenesisOrderer1:
    Orderer:
        Organizations:
            - *OrdererOrg1
    Consortiums:
        Consortium1:
            Organizations:
                - *Org1


ProfileForGenesisOrderer2:
    Orderer:
        Organizations:
            - *OrdererOrg2
    Consortiums:
        Consortium2:
            Organizations:
                - *Org2


ChannelOne:
    Consortium: Consortium1
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1


ChannelOne:
    Consortium: Consortium2
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org2

但是我遇到错误...恐慌:读取配置时出错:解析配置时:yaml:第412行:找不到预期的密钥 还有什么应该改变才能起作用?

相关问题