Fabric模块功能介绍(一)

news2024/11/24 21:08:53

主要有5个模块,分别是peer、orderer、cryptogen、configtxgen、configtxlator

模块功能
peer主节点模块,负责存储区块链数据、运行维护链码
orderer交易打包,排序模块
cryptogen组织和证书生成模块
configtxgen区块和交易生成模块
configtxlator区块和交易解析模块

peer和orderer属于系统模块,cryptogen、configtxgen和configtxlator属于工具模块。
Fabric模块配置信息由配置文件、命令行、环境变量三个部分构成。这三种配置方式存在如下关系:
环境变量>配置文件>命令行

cryptogen

该模块主要用来生成组织结构和账号相关的文件。一般都是先编写相关配置文件,用cryptogen模块生成相关证书文件。

cryptogen命令说明

一共有4个命令:
在这里插入图片描述

usage: cryptogen [<flags>] <command> [<args> ...]

**heip:**显示帮助信息
**generate:**根据配置文件生成证书信息

Flags:
  --help                    查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --output="crypto-config"  用来存放构件的输出目录。
  --config=CONFIG           使用的配置模板。

** shoetemplate:**显示系统默认的配置文件信息

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).

**extend:**拓展现有网络

Flags:
  --help                   查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --input="crypto-config"  存放现有网络的输入目录。、existing network place
  --config=CONFIG          使用的配置模板。

用法:

cryptogen extend --input="crypto-config" --config=config.yaml  org3.example.com

config.yaml 添加了一个新组org3.example.com。

**version:**显示当前模块版本号

cryptogen模块配置文件

OrdererOrgs:                                 //定义orderer节点
- Name: Orderer                        //orderer节点的名称
Domain: example.com               //orderer节点的根域名
Specs:
- Hostname: orderer          //orderer节点的主机名
PeerOrgs:
- Name: Org1                            //组织1的名称
Domain: org1.example.com         //组织1的根域名
Template:
Count: 2                       //组织1中的节点数目
Users:
Count:  1                       //组织1中的用户数目
- Name: Org2
Domain: org2.example.com
Template:
Count: 2
Users:
Count: 1

定义一个orderer节点,名字是orderer,根域名是example.com,定义了两个组织,分别是Org1、Org2,每个组织包含两个节点和一个用户。用户表示操作者,节点是部署到的服务器。

configtxgen

cnfigtxgen模块用于生成orderer的初始化文件和channel的初始化文件。

configtxgen模块主要命令有:

asOrg:所属的组织。
channelID:channel名字。
inspectBlock:打印制定区块文件中的配置内容。
inspectChannelCreateTx:打印创建通道的交易的配置文件。
outputAnchorPeersUpdate:更新Channel配置信息。
outputCreateChannelTx:输出创始块文件。
outputBlock:输出区块文件的路径。
profile:配置文件的节点。
version:显示版本信息。

配置文件

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

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

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Writers:
                Type: Signature
                Rule: "OR('OrdererMSP.member')"
            Admins:
                Type: Signature
                Rule: "OR('OrdererMSP.admin')"

        OrdererEndpoints:
            - orderer.example.com:7050

    - &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.example.com/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org1MSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('Org1MSP.peer')"

        # leave this flag set to true.
        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.example.com
              Port: 7051

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

        # ID to load the MSP definition as
        ID: Org2MSP

        MSPDir: crypto-config/peerOrganizations/org2.example.com/msp

        # Policies defines the set of policies at this level of the config tree
        # For organization policies, their canonical path is usually
        #   /Channel/<Application|Orderer>/<OrgName>/<PolicyName>
        Policies:
            Readers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
            Writers:
                Type: Signature
                Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
            Admins:
                Type: Signature
                Rule: "OR('Org2MSP.admin')"
            Endorsement:
                Type: Signature
                Rule: "OR('Org2MSP.peer')"

        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.org2.example.com
              Port: 9051

################################################################################
#
#   SECTION: Capabilities
#
#   - This section defines the capabilities of fabric network. This is a new
#   concept as of v1.1.0 and should not be utilized in mixed networks with
#   v1.0.x peers and orderers.  Capabilities define features which must be
#   present in a fabric binary for that binary to safely participate in the
#   fabric network.  For instance, if a new MSP type is added, newer binaries
#   might recognize and validate the signatures from this type, while older
#   binaries without this support would be unable to validate those
#   transactions.  This could lead to different versions of the fabric binaries
#   having different world states.  Instead, defining a capability for a channel
#   informs those binaries without this capability that they must cease
#   processing transactions until they have been upgraded.  For v1.0.x if any
#   capabilities are defined (including a map with all capabilities turned off)
#   then the v1.0.x peer will deliberately crash.
#
################################################################################
Capabilities:
    # Channel capabilities apply to both the orderers and the peers and must be
    # supported by both.
    # Set the value of the capability to true to require it.
    Channel: &ChannelCapabilities
        # V2_0 capability ensures that orderers and peers behave according
        # to v2.0 channel capabilities. Orderers and peers from
        # prior releases would behave in an incompatible way, and are therefore
        # not able to participate in channels at v2.0 capability.
        # Prior to enabling V2.0 channel capabilities, ensure that all
        # orderers and peers on a channel are at v2.0.0 or later.
        V2_0: true

    # Orderer capabilities apply only to the orderers, and may be safely
    # used with prior release peers.
    # Set the value of the capability to true to require it.
    Orderer: &OrdererCapabilities
        # V2_0 orderer capability ensures that orderers behave according
        # to v2.0 orderer capabilities. Orderers from
        # prior releases would behave in an incompatible way, and are therefore
        # not able to participate in channels at v2.0 orderer capability.
        # Prior to enabling V2.0 orderer capabilities, ensure that all
        # orderers on channel are at v2.0.0 or later.
        V2_0: true

    # Application capabilities apply only to the peer network, and may be safely
    # used with prior release orderers.
    # Set the value of the capability to true to require it.
    Application: &ApplicationCapabilities
        # V2_0 application capability ensures that peers behave according
        # to v2.0 application capabilities. Peers from
        # prior releases would behave in an incompatible way, and are therefore
        # not able to participate in channels at v2.0 application capability.
        # Prior to enabling V2.0 application capabilities, ensure that all
        # peers on channel are at v2.0.0 or later.
        V2_0: true

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

    # Policies defines the set of policies at this level of the config tree
    # For Application policies, their canonical path is
    #   /Channel/Application/<PolicyName>
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        LifecycleEndorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"
        Endorsement:
            Type: ImplicitMeta
            Rule: "MAJORITY Endorsement"

    Capabilities:
        <<: *ApplicationCapabilities
################################################################################
#
#   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
    OrdererType: etcdraft

    EtcdRaft:
        Consenters:
        - Host: orderer.example.com
          Port: 7050
          ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
          ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt

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

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

    # Policies defines the set of policies at this level of the config tree
    # For Orderer policies, their canonical path is
    #   /Channel/Orderer/<PolicyName>
    Policies:
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"
        # BlockValidation specifies what signatures must be included in the block
        # from the orderer for the peer to validate it.
        BlockValidation:
            Type: ImplicitMeta
            Rule: "ANY Writers"

################################################################################
#
#   CHANNEL
#
#   This section defines the values to encode into a config transaction or
#   genesis block for channel related parameters.
#
################################################################################
Channel: &ChannelDefaults
    # Policies defines the set of policies at this level of the config tree
    # For Channel policies, their canonical path is
    #   /Channel/<PolicyName>
    Policies:
        # Who may invoke the 'Deliver' API
        Readers:
            Type: ImplicitMeta
            Rule: "ANY Readers"
        # Who may invoke the 'Broadcast' API
        Writers:
            Type: ImplicitMeta
            Rule: "ANY Writers"
        # By default, who may modify elements at this config level
        Admins:
            Type: ImplicitMeta
            Rule: "MAJORITY Admins"

    # Capabilities describes the channel level capabilities, see the
    # dedicated Capabilities section elsewhere in this file for a full
    # description
    Capabilities:
        <<: *ChannelCapabilities

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

    TwoOrgsOrdererGenesis:
        <<: *ChannelDefaults
        Orderer:
            <<: *OrdererDefaults
            Organizations:
                - *OrdererOrg
            Capabilities:
                <<: *OrdererCapabilities
        Consortiums:
            SampleConsortium:
                Organizations:
                    - *Org1
                    - *Org2
    TwoOrgsChannel:
        Consortium: SampleConsortium
        <<: *ChannelDefaults
        Application:
            <<: *ApplicationDefaults
            Organizations:
                - *Org1
                - *Org2
            Capabilities:
                <<: *ApplicationCapabilities

配置文件主要分为个部分:
Organizations。
Capabilities.
Applications。
Orderer
Channel
Profiles

Organizations

通道成员的组织,每个组织都由MSPID和通道MSP标识。通道MSP存储在通道配置中,并包含用于标识组织的节点,应用程序和管理员的证书。
主要定义:
Name:用于标识组织的非正式名称
ID:组织的MSPID,充当组织的唯一标识符,并且由通道策略引用,提交给通道的交易中。
MSPDir:组织创建的MSP文件夹的路径。
Policies:用于定义一组通道成员签名策略。
AnchorPeers:列出组织的锚节点,

Capabilities

Fabric通道可以加入不同版本的orderer和peer节点,通道的功能根据版本可以启动某些功能。例如,只要通道功能级别设置为V1_4_X或更低,则运行Fabric v1.4的组织和运行Fabric v2.x的组织可以加入同一通道。所有通道成员都无法使用Fabric v2.0中引入的功能。
有三个字段定义:
Application:控制 Peer节点使用的功能
Orderer:可以控制Orderer节点的使用功能
Channel:设置可以由Peer节点和Orderer节点运行的Fabric最低版本。

Application

Application部分定义了控制Peer组织如何与应用程序通道交互的策略。这些策略控制需要批准链码定义或给更新通道配置的请求签名的Peer组织的数量。

Orderer

配置通道的共识机制包括Orderer节点。
OrdererType:用于选择共识机制。

Channel

通道部分定义了用于管理最高层级通道配置的策略。对于应用程序通道,这些策略控制哈希算法,用于创建新块的数据哈希结构以及通道功能级别。

Profiles

configtxgen工具读取Profiles部分中的通道配置文件以构建通道配置。每个配置文件都使用YAML语法从文件的其他部分收集数据。 configtxgen工具使用此配置为应用程序通道创建通道创建交易,或为系统通道写入通道创世块。

主要应用

生成创世区块:

 configtxgen -profile TwoOrgsOrdererGenesis -outputBlock ./genesis.block

创建channel初始块:

configtxgen -profile TwoOrgsChannel -outputCreateChannelTx ./channel.tx -channelID mychannel

创建锚节点更新:

configtxgen -profile TwoOrgsChannel -outputAnchorPeersUpdate ./Org1MSPanchors.tx -channelID mychannel -asOrg Org1MSP

configtxlator

这个模块是把区块链的二进制文件转化成JSON格式的文件。这个命令可以用REST服务器通过HTTP公开,也可以直接用命令行工具。

onfigtxlator [<flags>] <command> [<args> ...]

有六个命令:
Commands:
help//显示帮助信息
start//启动REST服务器

Flags:
  --help                查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --hostname="0.0.0.0"  REST 服务器监听的主机名或者 IP。
  --port=7059           REST 服务器监听的端口。
  --CORS=CORS ...       允许跨域的域名, 例如 ‘*’ 或者 ‘www.example.com’ (可能是重复的)。

proto_encode//将JSON转化为二进制

Flags:
  --help                查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --type=TYPE           要将 protobuf 编码成的类型。例如‘common.Config’。
  --input=/dev/stdin    包含 JSON 文档的文件。
  --output=/dev/stdout  要将输出写入的文件。

proto_decode //将二进制转化未JSON

 Flags:
  --help                查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --type=TYPE           要将 protobuf 解码成的类型。例如‘common.Config’。
  --input=/dev/stdin    包含 proto 消息的文件。
  --output=/dev/stdout  要将 JSON 文档写入的文件。

compute_update//比较两个编(marshaled)的 common.Config 信息,并计算它们的更新。

Flags:
  --help                   查看完整的帮助(可以尝试 --help-long 和 --help-man)。
  --original=ORIGINAL      原始配置信息。
  --updated=UPDATED        更新的配置信息。
  --channel_id=CHANNEL_ID  本次更新的通道名。
  --output=/dev/stdout     要将 JSON 文档写入的文件。

version//显示版本信息

 help [<command>...]
    Show help.

  start [<flags>]
    Start the configtxlator REST server

  proto_encode --type=TYPE [<flags>]
    Converts a JSON document to protobuf.

  proto_decode --type=TYPE [<flags>]
    Converts a proto message to JSON.

  compute_update --channel_id=CHANNEL_ID [<flags>]
    Takes two marshaled common.Config messages and computes the config update
    which transitions between the two.

  version
    Show version information

orderer

orderer模块负责对不同客户就端发送的交易进行排序和打包。
客户端向orderer模块发送交易。
Orderer节点对交易进行检查,如果符合条件,则将交易发送到排序队列)。
Orderer节点从消息队列中对取出交易并进行打包。打包之后会将相关的消息存储到本地存储中。Orderer节点根据客户端代码请求,将区块链发送给客户端。
orderer命令:

help  显示帮助信息
start* 启动orderer节点
version  显示版本信息
Show version information
benchmark采用基准本模式运行orderer

启动orderer节点可以使用启动配置文件的方法,也可以使用docker镜像文件的方法。

这是配置orderer.yaml文件的方法。

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

---
################################################################################
#
#   Orderer Configuration
#
#   - This controls the type and configuration of the orderer.
#
################################################################################
General:
    # Listen address: The IP on which to bind to listen.
    ListenAddress: 127.0.0.1

    # Listen port: The port on which to bind to listen.
    ListenPort: 7050

    # TLS: TLS settings for the GRPC server.
    TLS:
        Enabled: false
        # PrivateKey governs the file location of the private key of the TLS certificate.
        PrivateKey: tls/server.key
        # Certificate governs the file location of the server TLS certificate.
        Certificate: tls/server.crt
        RootCAs:
          - tls/ca.crt
        ClientAuthRequired: false
        ClientRootCAs:
    # Keepalive settings for the GRPC server.
    Keepalive:
        # ServerMinInterval is the minimum permitted time between client pings.
        # If clients send pings more frequently, the server will
        # disconnect them.
        ServerMinInterval: 60s
        # ServerInterval is the time between pings to clients.
        ServerInterval: 7200s
        # ServerTimeout is the duration the server waits for a response from
        # a client before closing the connection.
        ServerTimeout: 20s
    # Cluster settings for ordering service nodes that communicate with other ordering service nodes
    # such as Raft based ordering service.
    Cluster:
        # SendBufferSize is the maximum number of messages in the egress buffer.
        # Consensus messages are dropped if the buffer is full, and transaction
        # messages are waiting for space to be freed.
        SendBufferSize: 10
        # ClientCertificate governs the file location of the client TLS certificate
        # used to establish mutual TLS connections with other ordering service nodes.
        ClientCertificate:
        # ClientPrivateKey governs the file location of the private key of the client TLS certificate.
        ClientPrivateKey:
        # The below 4 properties should be either set together, or be unset together.
        # If they are set, then the orderer node uses a separate listener for intra-cluster
        # communication. If they are unset, then the general orderer listener is used.
        # This is useful if you want to use a different TLS server certificates on the
        # client-facing and the intra-cluster listeners.

        # ListenPort defines the port on which the cluster listens to connections.
        ListenPort:
        # ListenAddress defines the IP on which to listen to intra-cluster communication.
        ListenAddress:
        # ServerCertificate defines the file location of the server TLS certificate used for intra-cluster
        # communication.
        ServerCertificate:
        # ServerPrivateKey defines the file location of the private key of the TLS certificate.
        ServerPrivateKey:

    # Bootstrap method: The method by which to obtain the bootstrap block
    # system channel is specified. The option can be one of:
    #   "file" - path to a faile containing the genesis block or config block of system channel
    #   "none" - allows an orderer to start without a system channel configuration
    BootstrapMethod: file

    # Bootstrap file: The file containing the bootstrap block to use when
    # initializing the orderer system channel and BootstrapMethod is set to
    # "file".  The bootstrap file can be the genesis block, and it can also be
    # a config block for late bootstrap of some consensus methods like Raft.
    # Generate a genesis block by updating $FABRIC_CFG_PATH/configtx.yaml and
    # using configtxgen command with "-outputBlock" option.
    # Defaults to file "genesisblock" (in $FABRIC_CFG_PATH directory) if not specified.
    BootstrapFile:

    # LocalMSPDir is where to find the private crypto material needed by the
    # orderer. It is set relative here as a default for dev environments but
    # should be changed to the real location in production.
    LocalMSPDir: msp

    # LocalMSPID is the identity to register the local MSP material with the MSP
    # manager. IMPORTANT: The local MSP ID of an orderer needs to match the MSP
    # ID of one of the organizations defined in the orderer system channel's
    # /Channel/Orderer configuration. The sample organization defined in the
    # sample configuration provided has an MSP ID of "SampleOrg".
    LocalMSPID: SampleOrg

    # Enable an HTTP service for Go "pprof" profiling as documented at:
    # https://golang.org/pkg/net/http/pprof
    Profile:
        Enabled: false
        Address: 0.0.0.0:6060

    # BCCSP configures the blockchain crypto service providers.
    BCCSP:
        # Default specifies the preferred blockchain crypto service provider
        # to use. If the preferred provider is not available, the software
        # based provider ("SW") will be used.
        # Valid providers are:
        #  - SW: a software based crypto provider
        #  - PKCS11: a CA hardware security module crypto provider.
        Default: SW

        # SW configures the software based blockchain crypto provider.
        SW:
            # TODO: The default Hash and Security level needs refactoring to be
            # fully configurable. Changing these defaults requires coordination
            # SHA2 is hardcoded in several places, not only BCCSP
            Hash: SHA2
            Security: 256
            # Location of key store. If this is unset, a location will be
            # chosen using: 'LocalMSPDir'/keystore
            FileKeyStore:
                KeyStore:

        # Settings for the PKCS#11 crypto provider (i.e. when DEFAULT: PKCS11)
        PKCS11:
            # Location of the PKCS11 module library
            Library:
            # Token Label
            Label:
            # User PIN
            Pin:
            Hash:
            Security:
            FileKeyStore:
                KeyStore:

    # Authentication contains configuration parameters related to authenticating
    # client messages
    Authentication:
        # the acceptable difference between the current server time and the
        # client's time as specified in a client request message
        TimeWindow: 15m


################################################################################
#
#   SECTION: File Ledger
#
#   - This section applies to the configuration of the file or json ledgers.
#
################################################################################
FileLedger:

    # Location: The directory to store the blocks in.
    # NOTE: If this is unset, a new temporary location will be chosen every time
    # the orderer is restarted, using the prefix specified by Prefix.
    Location: /var/hyperledger/production/orderer

    # The prefix to use when generating a ledger directory in temporary space.
    # Otherwise, this value is ignored.
    Prefix: hyperledger-fabric-ordererledger

################################################################################
#
#   SECTION: Kafka
#
#   - This section applies to the configuration of the Kafka-based orderer, and
#     its interaction with the Kafka cluster.
#
################################################################################
Kafka:

    # Retry: What do if a connection to the Kafka cluster cannot be established,
    # or if a metadata request to the Kafka cluster needs to be repeated.
    Retry:
        # When a new channel is created, or when an existing channel is reloaded
        # (in case of a just-restarted orderer), the orderer interacts with the
        # Kafka cluster in the following ways:
        # 1. It creates a Kafka producer (writer) for the Kafka partition that
        # corresponds to the channel.
        # 2. It uses that producer to post a no-op CONNECT message to that
        # partition
        # 3. It creates a Kafka consumer (reader) for that partition.
        # If any of these steps fail, they will be re-attempted every
        # <ShortInterval> for a total of <ShortTotal>, and then every
        # <LongInterval> for a total of <LongTotal> until they succeed.
        # Note that the orderer will be unable to write to or read from a
        # channel until all of the steps above have been completed successfully.
        ShortInterval: 5s
        ShortTotal: 10m
        LongInterval: 5m
        LongTotal: 12h
        # Affects the socket timeouts when waiting for an initial connection, a
        # response, or a transmission. See Config.Net for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        NetworkTimeouts:
            DialTimeout: 10s
            ReadTimeout: 10s
            WriteTimeout: 10s
        # Affects the metadata requests when the Kafka cluster is in the middle
        # of a leader election.See Config.Metadata for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Metadata:
            RetryBackoff: 250ms
            RetryMax: 3
        # What to do if posting a message to the Kafka cluster fails. See
        # Config.Producer for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Producer:
            RetryBackoff: 100ms
            RetryMax: 3
        # What to do if reading from the Kafka cluster fails. See
        # Config.Consumer for more info:
        # https://godoc.org/github.com/Shopify/sarama#Config
        Consumer:
            RetryBackoff: 2s
    # Settings to use when creating Kafka topics.  Only applies when
    # Kafka.Version is v0.10.1.0 or higher
    Topic:
        # The number of Kafka brokers across which to replicate the topic
        ReplicationFactor: 3
    # Verbose: Enable logging for interactions with the Kafka cluster.
    Verbose: false

    # TLS: TLS settings for the orderer's connection to the Kafka cluster.
    TLS:

      # Enabled: Use TLS when connecting to the Kafka cluster.
      Enabled: false

      # PrivateKey: PEM-encoded private key the orderer will use for
      # authentication.
      PrivateKey:
        # As an alternative to specifying the PrivateKey here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of PrivateKey.
        #File: path/to/PrivateKey

      # Certificate: PEM-encoded signed public key certificate the orderer will
      # use for authentication.
      Certificate:
        # As an alternative to specifying the Certificate here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of Certificate.
        #File: path/to/Certificate

      # RootCAs: PEM-encoded trusted root certificates used to validate
      # certificates from the Kafka cluster.
      RootCAs:
        # As an alternative to specifying the RootCAs here, uncomment the
        # following "File" key and specify the file name from which to load the
        # value of RootCAs.
        #File: path/to/RootCAs

    # SASLPlain: Settings for using SASL/PLAIN authentication with Kafka brokers
    SASLPlain:
      # Enabled: Use SASL/PLAIN to authenticate with Kafka brokers
      Enabled: false
      # User: Required when Enabled is set to true
      User:
      # Password: Required when Enabled is set to true
      Password:

    # Kafka protocol version used to communicate with the Kafka cluster brokers
    # (defaults to 0.10.2.0 if not specified)
    Version:

################################################################################
#
#   Debug Configuration
#
#   - This controls the debugging options for the orderer
#
################################################################################
Debug:

    # BroadcastTraceDir when set will cause each request to the Broadcast service
    # for this orderer to be written to a file in this directory
    BroadcastTraceDir:

    # DeliverTraceDir when set will cause each request to the Deliver service
    # for this orderer to be written to a file in this directory
    DeliverTraceDir:

################################################################################
#
#   Operations Configuration
#
#   - This configures the operations server endpoint for the orderer
#
################################################################################
Operations:
    # host and port for the operations server
    ListenAddress: 127.0.0.1:8443

    # TLS configuration for the operations endpoint
    TLS:
        # TLS enabled
        Enabled: false

        # Certificate is the location of the PEM encoded TLS certificate
        Certificate:

        # PrivateKey points to the location of the PEM-encoded key
        PrivateKey:

        # Most operations service endpoints require client authentication when TLS
        # is enabled. ClientAuthRequired requires client certificate authentication
        # at the TLS layer to access all resources.
        ClientAuthRequired: false

        # Paths to PEM encoded ca certificates to trust for client authentication
        ClientRootCAs: []

################################################################################
#
#   Metrics  Configuration
#
#   - This configures metrics collection for the orderer
#
################################################################################
Metrics:
    # The metrics provider is one of statsd, prometheus, or disabled
    Provider: disabled

    # The statsd configuration
    Statsd:
      # network type: tcp or udp
      Network: udp

      # the statsd server address
      Address: 127.0.0.1:8125

      # The interval at which locally cached counters and gauges are pushed
      # to statsd; timings are pushed immediately
      WriteInterval: 30s

      # The prefix is prepended to all emitted statsd metrics
      Prefix:

################################################################################
#
#   Consensus Configuration
#
#   - This section contains config options for a consensus plugin. It is opaque
#     to orderer, and completely up to consensus implementation to make use of.
#
################################################################################
Consensus:
    # The allowed key-value pairs here depend on consensus plugin. For etcd/raft,
    # we use following options:

    # WALDir specifies the location at which Write Ahead Logs for etcd/raft are
    # stored. Each channel will have its own subdir named after channel ID.
    WALDir: /var/hyperledger/production/orderer/etcdraft/wal

    # SnapDir specifies the location at which snapshots for etcd/raft are
    # stored. Each channel will have its own subdir named after channel ID.
    SnapDir: /var/hyperledger/production/orderer/etcdraft/snapshot

或者配置docker-compose文件:

orderer.example.com:
    container_name: orderer.example.com
    image: hyperledger/fabric-orderer:latest
    environment:
      - FABRIC_LOGGING_SPEC=INFO
      - ORDERER_GENERAL_LISTENADDRESS=0.0.0.0
      - ORDERER_GENERAL_LISTENPORT=7050
      - ORDERER_GENERAL_GENESISMETHOD=file
      - ORDERER_GENERAL_GENESISFILE=/var/hyperledger/orderer/orderer.genesis.block
      - ORDERER_GENERAL_LOCALMSPID=OrdererMSP
      - ORDERER_GENERAL_LOCALMSPDIR=/var/hyperledger/orderer/msp
      # enabled TLS
      - ORDERER_GENERAL_TLS_ENABLED=true
      - ORDERER_GENERAL_TLS_PRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_TLS_CERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_TLS_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
      - ORDERER_KAFKA_TOPIC_REPLICATIONFACTOR=1
      - ORDERER_KAFKA_VERBOSE=true
      - ORDERER_GENERAL_CLUSTER_CLIENTCERTIFICATE=/var/hyperledger/orderer/tls/server.crt
      - ORDERER_GENERAL_CLUSTER_CLIENTPRIVATEKEY=/var/hyperledger/orderer/tls/server.key
      - ORDERER_GENERAL_CLUSTER_ROOTCAS=[/var/hyperledger/orderer/tls/ca.crt]
    working_dir: /opt/gopath/src/github.com/hyperledger/fabric
    command: orderer
    volumes:
        - ./channel-artifacts/genesis.block:/var/hyperledger/orderer/orderer.genesis.block
        - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp:/var/hyperledger/orderer/msp
        - ./crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/:/var/hyperledger/orderer/tls
        - orderer.example.com:/var/hyperledger/production/orderer
    ports:
      - 7050:7050
    networks:
      - test

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/589030.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【小程序开发日记】django学习笔记4

在没有学完django的情况下匆匆上阵。。。 这次的任务主要是管理数据库并实现浏览的功能。 首先介绍一下微信小程序连接后端的接口&#xff1a;wx.request 基本上输入后会比较经常使用的就是这几个参数。 接下来明确一下这次的工作&#xff1a; 我需要管理两个数据库&#x…

Python - numpy basic

目录 数组array的创建 1 通过list创建array 2 通过list创建二维数组 3 通过arange函数创建 等差数组 4 通过zeros函数创建 零矩阵 5 通过eyes函数创建 单位矩阵 数组array的访问 1 访问形状/元素个数/数据类型 2 访问一维数组的位置/范围 3 访问二维数组的位置/范围 4…

Unity Emisson 自发光属性全局照明

给想要自发光的物体&#xff0c;选择Unity自带Standard Shader。然后勾选Emisson 如下图&#xff1a; 属性&#xff1a; Color指定发光的颜色和强度。单击 Color 框可打开 HDR Color 拾色器。在此处可以更改光照的颜色和发光的强度 (Intensity)。要指定材质的哪些区域发光&…

蓝库云:让销售人员搭配客服工单系统,已成销售企业必备的组合

让销售人员搭配客服工单系统&#xff0c;已成了众多销售企业必备的组合&#xff0c;这不但可以大大提高客户满意度和转化率&#xff0c;还有效跟踪客户及时收到客户的反馈&#xff0c;从而进一步优化产品及策略。站在企业的角度来说企业也可以可以进行数据分析和优化&#xff0…

Mybaits Oracle CLob类型处理

问题描述: 使用的是Oracle 数据库, 表中有一个字段类型为clob类型 问题 : 当使用mybatis查询返回map类型时, 该字段的值为clob对象,而不是数据库里面的字符串 解决方案: 1.手动进行转换,把clob类型转换为字符串(这种比较简单) if(map.get("MAIN_BIZ") instanceo…

【Linux】iptables 防火墙(SNAT/DNAT)

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、SNAT 原理与应用二、SNAT转换三、DNAT的介绍1.DNAT概述2.DNAT转换前提条件 四、DNAT转换五、防火墙规则的备份和还原六、tcpdump抓包工具的运用 一、SNAT 原理与…

【Java 方法重写】@Override 注解,一般用法,重写的具体要求

&#x1f340; 博主&#xff1a;_LJaXi Or 東方幻想郷 &#x1f338; 专栏&#xff1a; Java | 从入门到入坟 从前有一只小鸟&#xff0c;它的父母都是优秀的飞行员&#xff0c;它也很想成为一名出色的飞行员。于是&#xff0c;它开始学习飞行技巧&#xff0c;不断练习&#xf…

微信支付, 小程序,公众号, 商户号 需要进行的配置

目录 一 微信公众号1.1 公众号基础信息配置1.2 白名单配置1.3 公众号开发人员配置1.4 域名授权配置1.5 服务器配置 二 微信小程序2.1 开发设置2.2 域名设置2.3 开发者管理2.4 版本管理 三 微信商户号3.1 支付服务3.2 授权域名3.3 配置API安全,支付证书申请3.4 设置支付信息3.5 …

CSDN上海城市开发者社区线下活动纪实

引言 5月27号中午&#xff0c;很高兴能和现CSDN副总裁、前微软 Azure 工程团队首席研发经理、技术畅销书《编程之美》及《构建之法》的作者邹欣邹老师&#xff0c;以及CSDN的 “上海城市开发者社区” 的部分成员齐聚一堂&#xff0c;参加CSDN上海城市开发者社区自5月初成立以来…

在windows环境下使用winsw将jar包注册为服务(实现开机自启和配置日志输出模式)

前言 Windows系统使用java -jar m命令行运行Java项目会弹出黑窗。首先容易误点导致程序关闭&#xff0c;其次我们希望能在Windows系统做到开机自动启动。因此对于SpringBoot程序&#xff0c;目前主流的方法是采用winsw&#xff0c;简单容易配置 1.下载winsw工具 https://git…

新手自媒体找素材必备的5个素材网站。

自媒体需要用到视频、音频、图片、字体等各类素材&#xff0c;对于新手朋友来说&#xff0c;网上搜素材怕侵权&#xff0c;商用素材又不知道哪里找。作为一个老手的我收藏了各类优秀的免费素材网站&#xff0c;下面分享几个&#xff0c;对你一定有帮助&#xff0c;记得收藏起来…

安科瑞预付费管理系统对于学生公寓的设计

安科瑞 徐浩竣 江苏安科瑞电器制造有限公司 zx acrelxhj 摘要&#xff1a;论文设计了适用于学生公寓的自助式预付费控电控水管理系统&#xff0c;采用多种智能功能&#xff0c;可以监测和显示漏电现象&#xff0c;通过短路、跳线、零线接地等方式防范和记录用户的偷电行为&a…

zookeeper机制及消息队列kafka

目录 一、zookeeper1、zookeeper简介2、zookeeper特点3、zookeeper工作模式及机制4、zookeeper应用场景及选举机制5、zookeeper集群部署 二、消息队列kafka1、为什么要有消息队列2、使用消息队列的好处3、kafka简介4、kafka特点5、kafka系统架构名词介绍6、Kafka架构及流程7、k…

Docker理论基础

初识Docker 1.什么是Docker 微服务虽然具备各种各样的优势&#xff0c;但服务的拆分通用给部署带来了很大的麻烦。 分布式系统中&#xff0c;依赖的组件非常多&#xff0c;不同组件之间部署时往往会产生一些冲突。 在数百上千台服务中重复部署&#xff0c;环境不一定一致&…

Docker容器核心技术:Linux命名空间Namespaces、控制组cgroups、联合文件系统UnionFS

1.容器的本质——进程 Docker 使用 Google 公司推出的 Go 语言 进行开发实现&#xff0c;基于 Linux 内核的 cgroup&#xff0c;namespace&#xff0c;以及 OverlayFS 类的 Union FS 等技术&#xff0c;对进程进行封装隔离&#xff0c;属于 操作系统层面的虚拟化技术。由于隔离…

react 接入企业微信登录组件

需求简述 把某web登录页替换成使用企业微信的扫码登录。 具体实现 自建应用&#xff1a;登录企微后台/应用管理&#xff0c;滑到最底部&#xff0c;创建应用并填写应用相关信息&#xff1a; 2. 创建成功之后&#xff0c;进入应用详情&#xff0c;配置可信域名以及授权登录&a…

k8s中iptables与ipvs详解——2023.05

文章目录 背景介绍一、Iptables模式二、IPVS模式&#xff08;NAT模式&#xff09;三、内部原理理解Iptablesipvs区别 补充&#xff1a;CoreDNS 背景介绍 从k8s的1.8版本开始&#xff0c;kube-proxy引入了IPVS模式&#xff0c;IPVS模式与iptables同样基于Netfilter&#xff0c;…

mysql ACID实现基本原理(面试题)

mysql ACID实现基本原理&#xff08;面试题&#xff09; 原子性一致性隔离性持久性 ACID&#xff0c;是指数据库管理系统&#xff08;DBMS&#xff09;在写入或更新资料的过程中&#xff0c;为保证事务&#xff08;transaction&#xff09;是正确可靠的&#xff0c;所必须具备的…

中介效应分析全流程汇总

一、中介效应说明 中介效应主要研究自变量对因变量影响的过程中&#xff0c;自变量是否通过中介变量再对因变量产生影响&#xff0c;那什么情况表明中介效应存在呢&#xff1f;如果自变量对因变量影响过程中&#xff0c;中介变量在模型中有着桥梁般的作用&#xff0c;那说明中…

Service事务优化(方法能否被事务控制?)

1.updateFile方法是否应该开启事务&#xff1f; 目前如果在updateFile方法上添加Transactional&#xff0c;当调用updateFile方法前会开启数据库事务&#xff0c;如果上传文件过程时间较长&#xff08;例如用户在上传超大视频文件&#xff09;&#xff0c;那么数据库的食物持续…