How can I add two orderers to the same channel?

无人久伴 提交于 2020-01-02 09:56:53

问题


I'm trying to build a network with two orders using Kafka.

In the first network example there is a script named./script.sh that creates a channel with an associated orderer that runs this command:

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

I already started implementing Kafka. But my question is How can I change this command to create a channel with two orders? Or is there a better way to do this?


回答1:


You do not add orderers to channel. An orderer belongs to an orderer organization. You can define multiple consortium that an orderer organization can serve. The definition of consortium is provided inside the definition of the Orderer Organization.

When you create an channel, you define which consortium it belongs to. The members you define in the channel, needs to be a part of that consortium.

Hence, if you define an orderer organization and you have multiple orderer nodes in them, it will serve all channels that its organization is a part of via consortiums.

Consider the below simplified example of 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

An orderer belonging to OrdererOrg1 will only its Consortium1 hence serve ChannelOne. Same is the case for OrdererOrg2.




回答2:


I want to have different orders for different orgs also. I am trying this on configtx.yaml from first network

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

But i get error... panic: Error reading configuration: While parsing config: yaml: line 412: did not find expected key What else should be changed to work?



来源:https://stackoverflow.com/questions/51099578/how-can-i-add-two-orderers-to-the-same-channel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!