Fabric命令手册

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

peer

peer命令帮助管理员对Fabric区块链网络中的节点进行管理,根据管理任务的 不同,peer命令细分为5个子命令。例如,你可以使用peer channel子命令来将 一个peer节点添加到通道(channel)中,或者使用peer chaincode子命令来将 一个智能合约链码部署到指定的peer节点。

语法

peer命令包含如下5个子命令:

peer chaincode [option] [flags]
peer channel   [option] [flags]
peer logging   [option] [flags]
peer node      [option] [flags]
peer version   [option] [flags]

每个子命令都有不同的选项(option),出于简化考虑,有时我们将命令(例如peer)、子命令(例如channel) 或子命令选项(例如fetch)都称为命令。

如果运行某个子命令时没有指定选项,那么它将返回相关的帮助信息。

每个peer子命令都有一套自己的标志(flag),其中许多标志被有意设计为全局标志, 以便可以在所有的子命令中使用该标志。我们将在相关的peer子命令中介绍这些标志。

peer命令的顶层标志如下:

  • --help:使用--help标志获取任何peer命令的帮助信息,该标志非常有价值,你可以用它 获得命令、子命令乃至选项的帮助

例如:

peer --help
peer channel --help
peer channel list --help

示例代码

下面的命令使用--help标志查看peer channel join命令的帮助信息:

~$ peer channel join --help

你可以在终端看到如下的帮助文本:

Joins the peer to a channel.

Usage:
  peer channel join [flags]

Flags:
  -b, --blockpath string   Path to file containing genesis block
  -h, --help               help for join

Global Flags:
      --cafile string                       Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoint
      --certfile string                     Path to file containing PEM-encoded X509 public key to use for mutual TLS communication with the orderer endpoint
      --clientauth                          Use mutual TLS when communicating with the orderer endpoint
      --connTimeout duration                Timeout for client to connect (default 3s)
      --keyfile string                      Path to file containing PEM-encoded private key to use for mutual TLS communication with the orderer endpoint
  -o, --orderer string                      Ordering service endpoint
      --ordererTLSHostnameOverride string   The hostname override to use when validating the TLS connection to the orderer.
      --tls                                 Use TLS when communicating with the orderer endpoint