Patryk Steckel
Patryk Steckel

Reputation: 11

Can single orderer handle mutliple channels?

Can single orderer handle multiple channels?

This is .yaml configuration of orderer:

orderer_example_com:
  container_name: orderer.example.com
  image: hyperledger/fabric-orderer
  environment:
    - ORDERER_GENERAL_LOGLEVEL=debug
    - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
    - ORDERER_GENERAL_GENESISMETHOD=file
    - ORDERER_GENERAL_GENESISFILE=/etc/hyperledger/configtx/genesis1.block
    - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
    - ORDERER_GENERAL_LOCALMSPDIR=/etc/hyperledger/crypto/orderer/msp
    - ORDERER_GENERAL_TLS_ENABLED=true
    - ORDERER_GENERAL_TLS_PRIVATEKEY=/etc/hyperledger/crypto/orderer/tls/server.key
    - ORDERER_GENERAL_TLS_CERTIFICATE=/etc/hyperledger/crypto/orderer/tls/server.crt
   - ORDERER_GENERAL_TLS_ROOTCAS=[/etc/hyperledger/crypto/orderer/tls/ca.crt, /etc/hyperledger/crypto/peerOrg1/tls/ca.crt, /etc/hyperledger/crypto/peerOrg2/tls/ca.crt, /etc/hyperledger/crypto/peerOrg3/tls/ca.crt]
  working_dir: /opt/gopath/src/github.com/hyperledger/fabric/orderers
  command: orderer
  ports:
    - 7050:7050
  volumes:
    - ./channel:/etc/hyperledger/configtx
    - ./channel/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/:/etc/hyperledger/crypto/orderer
    - ./channel/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/:/etc/hyperledger/crypto/peerOrg1
    - ./channel/crypto-config/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/:/etc/hyperledger/crypto/peerOrg2
    - ./channel/crypto-config/peerOrganizations/org3.example.com/peers/peer0.org3.example.com/:/etc/hyperledger/crypto/peerOrg3
  networks:
    chfn:
      aliases:
       - orderer.example.com

I have 1 genesis file for each channel and property ORDERER_GENERAL_GENESISFILE is set to just one of them. Should I define orderers for each channel?

Upvotes: 0

Views: 867

Answers (3)

christo4ferris
christo4ferris

Reputation: 4037

The TL;DR: of @Artem's response is yes, an ordering service in Hyperledger Fabric can handle multiple channels.

The orderer service may have multiple nodes, to provide resilience of the service implemented by some fault tolerant protocol such as PAXOS, RAFT, *BFT, etc. For the Kafka orderer, we currently support crash fault tolerance.

Fabric also supports a topology model that has multiple distinct orderer services, each supporting a non-overlapping set of channels.

Peer nodes can participate in multiple channels, and those channels may each be supported by different orderer services.

Upvotes: 0

tiennv
tiennv

Reputation: 356

Yes. We can a single order for multiple channels. But we should have many orders to keep the system available.

Upvotes: 0

Artem Barger
Artem Barger

Reputation: 41222

If you take a look on configtx.yaml file which actually includes all relevant information to be encoded into ordering service genesis block, such as the Organizations which defines all know organization at the bootstrap stage which might form a consortium to initiate a channel. In fact the configtxgen encodes org related crypto material into the genesis block, such that orderer will be able to validate identity of the peers who tries to submit transactions or get connected to deliver new blocks.

################################################################################
#
#   Section: Organizations
#
#   - This section defines the different organizational identities which will
#   be referenced later in the configuration.
#
################################################################################
Organizations:

    # SampleOrg defines an MSP using the sampleconfig.  It should never be used
    # in production but may be used as a template for other definitions
    - &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/example.com/msp

While this genesis block has nothing to do with the genesis block which created with new channel. So to your question one ordering service can able to handle multiple channels as long as they consist of know organizations. You can define profiles for configtxgen tool to specify a list of organization to be encoded as consortium for specific channel, for example:

Orgs12Channel:                                                                                                                                                                                                                    
    Consortium: SampleConsortium
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org2

Defines channel of two organizations Org1 and Org2, whereas

Orgs13Channel:
    Consortium: SampleConsortium
    Application:
        <<: *ApplicationDefaults
        Organizations:
            - *Org1
            - *Org3

could define an additional channel of Org1 and Org3. After all the configuration for ordering service which defines consortium and lists all organizations which could define channels.

OrdererGenesis:
    Orderer:
        <<: *OrdererDefaults
        Organizations:
            - *OrdererOrg
    Consortiums:
        SampleConsortium:
            Organizations:
                - *Org1
                - *Org2
                - *Org3

Upvotes: 1

Related Questions