The Hyperledger Fabric ordering service provides an atomic broadcast ordering service for consumption by the peers. This means that many clients can submit messages to the ordering service, and the same sequence of ordered batches will be delivered to all clients in response.
The atomic broadcast ordering protocol for Hyperledger Fabric is described in hyperledger/fabric/protos/orderer/ab.proto
. There are two services: the Broadcast
service for injecting messages into the system and the Deliver
service for receiving ordered batches from the service.
ab.proto
definition so that the peer orderer client code does not to be written specifically for Kafka. Kafka is currently the preferred choice for production deployments which demand high throughput and high availability, but do not require byzantine fault tolerance.In order to set a service type, the ordering service administrator needs to set the right value in the genesis block that the ordering service nodes will be bootstrapped from.
Specifically, the value corresponding to the ConsensusType
key of the Values
map of the Orderer
config group on the system channel should be set to either solo
or kafka
.
For details on the configuration structure of channels, refer to the Channel Configuration guide.
configtxgen
is a tool that allows for the creation of a genesis block using profiles, or grouped configuration parameters — refer to the Configuring using the connfigtxgen tool guide for more.
The location of this block can be set using the ORDERER_GENERAL_GENESISFILE
environment variable. As is the case with all the configuration paths for Fabric binaries, this location is relative to the path set via the FABRIC_CFG_PATH
environment variable.
Because the ordering service must allow clients to seek within the ordered batch stream, orderers need a backing ledger, where they maintain a local copy of past batches. Not all ledgers are crash fault tolerant, so care should be used when selecting a ledger for an application. Because the orderer ledger interface is abstracted, the ledger type for a particular orderer may be selected at runtime. The following options are available:
This can be set by setting the ORDERER_GENERAL_LEDGERTYPE
environment variable before executing the orderer
binary. Acceptable values are file
(default), ram
, and json
.
To experiment with the orderer service you may build the orderer binary by simply typing go build
in the hyperledger/fabric/orderer
directory. You may then invoke the orderer binary with no parameters, or you can override the bind address, port, and backing ledger by setting the environment variables ORDERER_GENERAL_LISTENADDRESS
, ORDERER_GENERAL_ LISTENPORT
and ORDERER_GENERAL_LEDGER_TYPE
respectively.
There are sample clients in the fabric/orderer/sample_clients
directory.
broadcast_timestamp
client sends a message containing the timestamp to the Broadcast
service.deliver_stdout
client prints received batches to stdout from the Deliver
interface.These may both be built simply by typing go build
in their respective directories. Note that neither of these clients supports config (so editing the source manually to adjust address and port is required), or signing (so they can only work against channels where no ACL is enforced).
Profiling the ordering service is possible through a standard HTTP interface documented here. The profiling service can be configured using the orderer.yaml file, or through environment variables. To enable profiling set ORDERER_GENERAL_PROFILE_ENABLED=true
, and optionally set ORDERER_GENERAL_PROFILE_ADDRESS
to the desired network address for the profiling service. The default address is 0.0.0.0:6060
as in the Golang documentation.
Note that failures of the profiling service, either at startup or anytime during the run, will cause the overall orderer service to fail. Therefore it is currently not recommended to enable profiling in production settings.
This work is licensed under a Creative Commons Attribution 4.0 International License.
s
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。