Consul CLI是一个易用的命令行应用程序。在错误情况下,将返回一个非零的退出状态码。它还响应你最可能期望的 -h–help 。而且一些命令还接受“-”作为一个参数,来让Consul读取标准输入。


$ consul
usage: consul [--version] [--help] <command> [<args>]

Available commands are:
	agent          Runs a Consul agent
	event          Fire a new event
	exec           Executes a command on Consul nodes
	force-leave    Forces a member of the cluster to enter the "left" state
	info           Provides debugging information for operators
	join           Tell Consul agent to join cluster
	keygen         Generates a new encryption key
	keyring        Manages gossip layer encryption keys
	leave          Gracefully leaves the Consul cluster and shuts down
	lock           Execute a command holding a lock
	members        Lists the members of a Consul cluster
	monitor        Stream logs from a Consul agent
	operator       Provides cluster-level tools for Consul operators
	reload         Triggers the agent to reload configuration files
	rtt            Estimates network round trip time between nodes
	version        Prints the Consul version
	watch          Watch for changes in Consul

要获取任何指定命令的帮助,将 -h 参数传递给相关的子命令。例如,要看 join 子命令的帮助:

$ consul join -h
Usage: consul join [options] address ...

  Tells a running Consul agent (with "consul agent") to join the cluster
  by specifying at least one existing member.


  -rpc-addr=  Address to the RPC server of the agent you want to contact
							to send this command. If this isn't specified, the command checks the
							CONSUL_RPC_ADDR env variable.
  -wan                      Joins a server to another server in the WAN pool