如何在超级账本结构中添加筏而不是kafka?

时间:2019-05-28 12:51:23

标签: hyperledger-fabric hyperledger blockchain

如何在hyperledger fabric altoros面料供应链项目中添加 raft 而不是kafka?     这是我的configtxtemplate-OneOrg-orderer.yaml文件

---
################################################################################
#
#   Profile
#
#   - Different configuration profiles may be encoded here to be specified
#   as parameters to the configtxgen tool
#
################################################################################
Profiles:

    OrdererGenesis:
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *ORG1
    common:
        Consortium: SampleConsortium
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *ORG1

    CHANNEL_NAME:
        Consortium: SampleConsortium
        Application:
            Organizations:
                - *ORG1

################################################################################
#
#   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: OrdererMSP

        # ID to load the MSP definition as
        ID: OrdererMSP

        # MSPDir is the filesystem path which contains the MSP configuration
        MSPDir: crypto-config/ordererOrganizations/DOMAIN/msp

    - &ORG1
        # DefaultOrg defines the organization which is used in the sampleconfig
        # of the fabric.git development environment
        Name: ORG1MSP

        # ID to load the MSP definition as
        ID: ORG1MSP

        MSPDir: crypto-config/peerOrganizations/ORG1.DOMAIN/msp

        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.ORG1.DOMAIN
              Port: 7051


################################################################################
#
#   SECTION: Orderer
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults

    # Orderer Type: The orderer implementation to start
    # Available types are "solo" and "kafka"
    OrdererType: solo

    Addresses:
        - orderer.DOMAIN: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: 98 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 is the list of orgs which are defined as participants on
    # the orderer side of the network
    Organizations:

################################################################################
#
#   SECTION: Application
#
#   - This section defines the values to encode into a config transaction or
#   genesis block for application related parameters
#
################################################################################
Application: &ApplicationDefaults

    # Organizations is the list of orgs which are defined as participants on
    # the application side of the network
    Organizations:

能否请您检查我要去哪里以及必须在哪些文件中进行更改。 我浏览了Raft的文档,但我不太了解它,也没有很好的资源或教程可以通过。如果您知道任何好的来源或示例,请提供帮助。 我看到超级账本结构社区不像区块链那样强大于比特币或以太坊。我要在其上构建应用程序时遇到很多麻烦。我会要求您从可以学到最好的地方来帮助我。

1 个答案:

答案 0 :(得分:1)

您可以阅读documentation了解更多详细信息和说明,而关键概念是:

  1. 要使用Raft,您需要配置订购服务以使用TLS。

  2. 将订购者类型更改为

    OrdererType: etcdraft
    
  3. 您需要通过添加以下部分的配置来设置中心集(筏副本):

    Consenters:
    
        - Host: raft0.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert0
          ServerTLSCert: path/to/ServerTLSCert0
        - Host: raft1.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert1
          ServerTLSCert: path/to/ServerTLSCert1
        - Host: raft2.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert2
          ServerTLSCert: path/to/ServerTLSCert2
    

在其中提供配置以设置群集,包括用于中心的TLS证书。

例如Raft的个人资料可能如下所示,SampleDevModeEtcdRaft个人资料:

SampleDevModeEtcdRaft:
  <<: *ChannelDefaults
Capabilities:
  <<: *ChannelCapabilities
  Orderer:
    <<: *OrdererDefaults
    OrdererType: etcdraft
    EtcdRaft:
    Consenters:
        - Host: raft0.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert0
          ServerTLSCert: path/to/ServerTLSCert0
        - Host: raft1.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert1
          ServerTLSCert: path/to/ServerTLSCert1
        - Host: raft2.example.com
          Port: 7050
          ClientTLSCert: path/to/ClientTLSCert2
          ServerTLSCert: path/to/ServerTLSCert2        
  Organizations:
      - *OrdererOrg
    Capabilities:
      <<: *OrdererCapabilities
  Application:
    <<: *ApplicationDefaults
    Organizations:
    - <<: *OrdererOrg
  Consortiums:
    SampleConsortium:
      Organizations:
      - *Org1
      - *Org2
相关问题