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?
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.