orderer.yaml是orderer节点的配置文件,凡是orderer需要设置的内容,全在这里找。该orderer.yaml示例配置文件指定了如下五大部分内容。
General部分是orderer.yaml配置文件的基础配置信息部分,主要指定配置如下:

如果指定分类账本类型为文件类型,则通过FileLedger部分配置文件账本的相关信息。
Location指定区块链的本地存储路径。
Prefix指定临时空间中的前缀名称(未指定Location时)。
如果分类账本指定不使用文件账本类型,而是内存账本类型时,则需要通过HistorySize属性指定在内存中保存区块的最大数量。
如果Orderer服务使用Kafka实现排序服务,则进行相关的配置信息指定:
Retry指定连接到Kafka的重试请求信息。
Verbose指定是否启用日志记录。
TLS指定Orderer连接到Kafka的TLS相关设置,包括是否启动TLS,指定TLS密钥、证书及可信任的CA根证书。
Version指定Kafka的版本信息。
此部分配置信息相对简单,主要指定广播服务与交付服务的请求保存目录。
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
---
################################################################################
#
# Orderer Configuration
#
# - This controls the type and configuration of the orderer.
#
################################################################################
General:
# 监听地址
ListenAddress: 127.0.0.1
# 监听端口号
ListenPort: 7050
# GRPC服务器的TLS设置
TLS:
# 在实际生产网络中,应该使用 TLS 安全通信,这个值应该是true
# 默认不启用
Enabled: false
# 提供 TLS CA 为此节点生成的私钥的路径和文件名。
PrivateKey: tls/server.key
# 提供 TLS CA 为该节点生成的公共证书(也称为签名证书)的路径和文件名。
Certificate: tls/server.crt
# (应注释掉)此参数通常未设置以供正常使用。
# 它是附加根证书的路径列表,用于在出站连接期间验证其他排序节点的证书。
# 它可用于扩充每个通道配置的 MSP 中可用的 TLS CA 证书集。
# 可信任的根CA证书
RootCAs:
- tls/ca.crt
ClientAuthRequired: false
ClientRootCAs:
# GRPC服务器的激活设置
Keepalive:
# # 客户机ping之间的最小允许时间(除非通过测试确定有必要,否则不应覆盖默认值)
ServerMinInterval: 60s
# 连接到客户机的ping之间的时间(除非通过测试确定有必要,否则不应覆盖默认值)
ServerInterval: 7200s
# 服务器等待响应的超时时间(除非通过测试确定有必要,否则不应覆盖默认值)
ServerTimeout: 20s
# 由于所有节点都应该一致,建议将MaxRecVMGSize和MaxSendMsgSize的默认值保持为100MB
# GRPC服务器和客户端可以接收的最大消息大小(字节)
MaxRecvMsgSize: 104857600
# GRPC服务器和客户端可以发送的最大消息大小(字节)
MaxSendMsgSize: 104857600
# 与其他订购服务节点(如基于Raft的订购服务)通信的订购服务节点的群集设置。
Cluster:
# SendBufferSize 是缓冲区中的最大消息数。
# 如果缓冲区已满,共识消息将被丢弃,交易消息就会被等待去释放。
SendBufferSize: 10
# 管理客户端TLS证书的文件位置用于与其他订购服务节点建立相互TLS连接。
# 如果未设置,则服务器将处于常规状态。TLS证书被重复使用
ClientCertificate:
# 管理客户端TLS证书的私钥的文件位置。
# 如果未设置,则服务器将处于常规状态。TLS私钥被重复使用。
ClientPrivateKey:
# 以下4个属性要么一起设置,要么一起取消设置。
# 如果设置了它们,那么order节点将使用单独的侦听器进行集群内通信。
# 如果它们未设置,则使用常规Order侦听器。
# 如果希望在面向客户机的侦听器和集群内侦听器上使用不同的TLS服务器证书,这非常有用。
# 定义群集侦听连接的端口
ListenPort:
# 定义用于侦听集群内通信的IP
ListenAddress:
# 定义用于集群内通信的服务器TLS证书的文件位置。
ServerCertificate:
# 定义TLS证书的私钥的文件位置。
ServerPrivateKey:
# Bootstrap method: 指定获取引导块系统通道的方法。
# "file" - 包含文件块或系统通道的Config块的文件路径
# "none" - 允许订购器启动,而无需系统频道配置
BootstrapMethod: none
# 指定创建此节点时要使用的系统通道创世块的位置和名称。
# (如果您要创建此节点以加入系统通道,则应覆盖默认值)
# 如果您在不使用系统通道的情况下创建此节点,则不会使用此值,因此可以留空。
BootstrapFile:
# 排序节点的本地 MSP 的路径,必须在部署之前创建。
LocalMSPDir: msp
# 标识了这个排序节点所属的组织
# MSP ID 必须与此加入将加入的任何通道的配置中存在的排序者组织 MSP ID 匹配。
LocalMSPID: SampleOrg
# 为Go“pprof”评测启用HTTP服务,如以下所述:
# https://golang.org/pkg/net/http/pprof
Profile:
Enabled: false
Address: 0.0.0.0:6060
# BCCSP配置BlockChain Crypto服务提供商。
BCCSP:
# 默认值指定要使用的首选区块链加密服务提供商。
# 如果首选提供商不可用,将使用基于软件的提供商(“SW”)。
# 有效的提供者包括:
# - SW: 一种基于软件加密提供程序
# - PKCS11: CA硬件安全模块加密提供商。
Default: SW
# SW配置基于软件的SlowtChain Crypto提供商。
SW:
# 默认哈希和安全级别需要重构才能完全配置。
# 更改这些默认值需要协调,SHA2在多个地方硬编码,而不仅仅是BCCSP
Hash: SHA2
Security: 256
# 密钥的位置. If this is unset, a location will be
# 如果未设置,将选择使用位置'LocalMSPDir'/keystore
FileKeyStore:
KeyStore:
# PKCS#11 Crypto Provider的设置(即默认值:PKCS11)
PKCS11:
# Location of the PKCS11 module library
Library:
# Token Label
Label:
# User PIN
Pin:
Hash:
Security:
FileKeyStore:
KeyStore:
# 身份验证包含与验证客户端消息相关的配置参数
Authentication:
# 当前服务器时间和客户端请求消息中指定的客户端时间之间的可接受差异
TimeWindow: 15m
################################################################################
#
# SECTION: File Ledger
#
# - 本节文本账本配置信息。
#
################################################################################
FileLedger:
# 区块存储路径
Location: /var/hyperledger/production/orderer
################################################################################
#
# SECTION: Kafka
#
# - Kafka 集群的配置信息
#
#
################################################################################
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.
# 无法建立到Kafka集群的连接时的重试请求
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
# 向Kafka集群发送消息失败的设置
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
# 向Kafka集群读取消息失败的设置
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.
# 是否为与Kafka集群的交互启用日志记录
Verbose: false
# TLS: TLS settings for the orderer's connection to the Kafka cluster.
TLS:
# Orderer连接到Kafka集群的TLS设置
# Enabled: Use TLS when connecting to the Kafka cluster.
# 连接到Kafka集群时是否使用TLS
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
#
# - 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
#
# - 操作服务用于监控排序节点的健康状况,并依靠双向 TLS 来保护其通信。
# - 如果打算使用 Prometheus 指标来监控的排序节点,则必须在此处配置操作服务。
################################################################################
Operations:
# 指定运维服务器的地址和端口。
ListenAddress: 127.0.0.1:8443
# TLS configuration for the operations endpoint
TLS:
# 如果正在使用运营服务,则必须是 ture
Enabled: false
# 证书是PEM编码的TLS证书的位置
Certificate:
# PrivateKey指向PEM编码密钥的位置
PrivateKey:
# 必须设置true为启用客户端和服务器之间的双向 TLS
# ClientAuthRequired需要在TLS层进行客户端证书身份验证才能访问所有资源
ClientAuthRequired: false
# 类似于TLS中的客户端根CA证书文件,它包含可用于验证客户端证书的客户端根CA证书列表。
# 如果客户端注册了 orderer 组织 CA,则此值是 orderer 组织根 CA 证书。
ClientRootCAs: []
################################################################################
#
# Metrics Configuration
#
# - This configures metrics collection for the orderer
# - 默认情况下这是禁用的,但如果你想监控排序者的指标,你需要使用StatsD或Prometheus作为你的
- 指标提供者。
################################################################################
Metrics:
# 将此值设置为statsd、prometheus或者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:
################################################################################
#
# Admin Configuration
#
# - 这将为订购方配置管理服务器端点
#
################################################################################
Admin:
# 可以使用的 orderer 管理服务器地址(主机和端口)
ListenAddress: 127.0.0.1:9443
# TLS configuration for the admin endpoint
TLS:
# TLS enabled
Enabled: false
# TLS CA 颁发的 orderer 签名证书的路径和文件名。
Certificate:
# TLS CA 发布的 orderer 私钥的路径和文件名。
PrivateKey:
# 此值必须设置为true。
# 请注意,虽然 ordererAdmin端点上的所有操作都需要双向 TLS,
# 但整个网络不需要使用双向 TLS。
ClientAuthRequired: true
# 管理客户端 TLS CA 根证书的路径和文件名。
ClientRootCAs: []
################################################################################
#
# Channel participation API Configuration
#
# - 这为订购方提供了通道参与API配置
# - 频道参与使用管理服务的ListenAddress和TLS设置。
#
#
################################################################################
ChannelParticipation:
# 启用通道参与API
Enabled: false
# 加入频道时请求主体的最大大小
MaxRequestBodySize: 1 MB
################################################################################
#
# Consensus Configuration
#
# - 本节包含共识插件的配置选项 它对orderer来说是不透明的,完全取决于一致意见的实现
#
#
################################################################################
Consensus:
# The allowed key-value pairs here depend on consensus plugin. For etcd/raft,
# we use following options:
# 这是排序节点本地文件系统上预写日志的路径
# 每个频道都有自己的以频道 ID 命名的子目录
WALDir: /var/hyperledger/production/orderer/etcdraft/wal
# 这是排序节点本地文件系统上快照的路径
# 每个频道都有自己的以频道 ID 命名的子目录
SnapDir: /var/hyperledger/production/orderer/etcdraft/snapshot
我有一个字符串input="maybe(thisis|thatwas)some((nice|ugly)(day|night)|(strange(weather|time)))"Ruby中解析该字符串的最佳方法是什么?我的意思是脚本应该能够像这样构建句子:maybethisissomeuglynightmaybethatwassomenicenightmaybethiswassomestrangetime等等,你明白了......我应该一个字符一个字符地读取字符串并构建一个带有堆栈的状态机来存储括号值以供以后计算,还是有更好的方法?也许为此目的准备了一个开箱即用的库?
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
我试图在一个项目中使用rake,如果我把所有东西都放到Rakefile中,它会很大并且很难读取/找到东西,所以我试着将每个命名空间放在lib/rake中它自己的文件中,我添加了这个到我的rake文件的顶部:Dir['#{File.dirname(__FILE__)}/lib/rake/*.rake'].map{|f|requiref}它加载文件没问题,但没有任务。我现在只有一个.rake文件作为测试,名为“servers.rake”,它看起来像这样:namespace:serverdotask:testdoputs"test"endend所以当我运行rakeserver:testid时
我的目标是转换表单输入,例如“100兆字节”或“1GB”,并将其转换为我可以存储在数据库中的文件大小(以千字节为单位)。目前,我有这个:defquota_convert@regex=/([0-9]+)(.*)s/@sizes=%w{kilobytemegabytegigabyte}m=self.quota.match(@regex)if@sizes.include?m[2]eval("self.quota=#{m[1]}.#{m[2]}")endend这有效,但前提是输入是倍数(“gigabytes”,而不是“gigabyte”)并且由于使用了eval看起来疯狂不安全。所以,功能正常,
Rails2.3可以选择随时使用RouteSet#add_configuration_file添加更多路由。是否可以在Rails3项目中做同样的事情? 最佳答案 在config/application.rb中:config.paths.config.routes在Rails3.2(也可能是Rails3.1)中,使用:config.paths["config/routes"] 关于ruby-on-rails-Rails3中的多个路由文件,我们在StackOverflow上找到一个类似的问题
对于具有离线功能的智能手机应用程序,我正在为Xml文件创建单向文本同步。我希望我的服务器将增量/差异(例如GNU差异补丁)发送到目标设备。这是计划:Time=0Server:hasversion_1ofXmlfile(~800kiB)Client:hasversion_1ofXmlfile(~800kiB)Time=1Server:hasversion_1andversion_2ofXmlfile(each~800kiB)computesdeltaoftheseversions(=patch)(~10kiB)sendspatchtoClient(~10kiBtransferred)Cl
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
我主要使用Ruby来执行此操作,但到目前为止我的攻击计划如下:使用gemsrdf、rdf-rdfa和rdf-microdata或mida来解析给定任何URI的数据。我认为最好映射到像schema.org这样的统一模式,例如使用这个yaml文件,它试图描述数据词汇表和opengraph到schema.org之间的转换:#SchemaXtoschema.orgconversion#data-vocabularyDV:name:namestreet-address:streetAddressregion:addressRegionlocality:addressLocalityphoto:i
使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta
我正在使用ruby1.9解析以下带有MacRoman字符的csv文件#encoding:ISO-8859-1#csv_parse.csvName,main-dialogue"Marceu","Giveittohimóhe,hiswife."我做了以下解析。require'csv'input_string=File.read("../csv_parse.rb").force_encoding("ISO-8859-1").encode("UTF-8")#=>"Name,main-dialogue\r\n\"Marceu\",\"Giveittohim\x97he,hiswife.\"\