2014-02-08 00:41:03 +00:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Commands"
|
|
|
|
sidebar_current: "docs-commands"
|
|
|
|
---
|
|
|
|
|
2014-02-19 01:32:13 +00:00
|
|
|
# Consul Commands (CLI)
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:32:13 +00:00
|
|
|
Consul is controlled via a very easy to use command-line interface (CLI).
|
|
|
|
Consul is only a single command-line application: `consul`. This application
|
2014-02-08 00:41:03 +00:00
|
|
|
then takes a subcommand such as "agent" or "members". The complete list of
|
|
|
|
subcommands is in the navigation to the left.
|
|
|
|
|
2014-02-19 01:32:13 +00:00
|
|
|
The `Consul` CLI is a well-behaved command line application. In erroneous
|
2014-02-08 00:41:03 +00:00
|
|
|
cases, a non-zero exit status will be returned. It also responds to `-h` and `--help`
|
|
|
|
as you'd most likely expect. And some commands that expect input accept
|
2014-02-19 01:32:13 +00:00
|
|
|
"-" as a parameter to tell Consul to read the input from stdin.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:32:13 +00:00
|
|
|
To view a list of the available commands at any time, just run `consul` with
|
2014-02-08 00:41:03 +00:00
|
|
|
no arguments:
|
|
|
|
|
|
|
|
```
|
2014-02-19 01:32:13 +00:00
|
|
|
$ consul
|
|
|
|
usage: consul [--version] [--help] <command> [<args>]
|
2014-02-08 00:41:03 +00:00
|
|
|
|
|
|
|
Available commands are:
|
2014-02-19 01:32:13 +00:00
|
|
|
agent Runs a Consul agent
|
2014-02-08 00:41:03 +00:00
|
|
|
force-leave Forces a member of the cluster to enter the "left" state
|
2014-02-24 01:09:59 +00:00
|
|
|
info Provides debugging information for operators
|
2014-02-19 01:32:13 +00:00
|
|
|
join Tell Consul agent to join cluster
|
2014-02-08 00:41:03 +00:00
|
|
|
keygen Generates a new encryption key
|
2014-02-19 01:32:13 +00:00
|
|
|
leave Gracefully leaves the Consul cluster and shuts down
|
|
|
|
members Lists the members of a Consul cluster
|
|
|
|
monitor Stream logs from a Consul agent
|
2014-06-11 18:03:59 +00:00
|
|
|
reload Triggers the agent to reload configuration files
|
2014-02-19 01:32:13 +00:00
|
|
|
version Prints the Consul version
|
2014-08-22 00:25:42 +00:00
|
|
|
watch Watch for changes in Consul
|
2014-02-08 00:41:03 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
To get help for any specific command, pass the `-h` flag to the relevant
|
2014-06-11 18:08:19 +00:00
|
|
|
subcommand. For example, to see help about the `join` subcommand:
|
2014-02-08 00:41:03 +00:00
|
|
|
|
|
|
|
```
|
2014-06-11 18:08:19 +00:00
|
|
|
$ consul join -h
|
|
|
|
Usage: consul join [options] address ...
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-06-11 18:08:19 +00:00
|
|
|
Tells a running Consul agent (with "consul agent") to join the cluster
|
|
|
|
by specifying at least one existing member.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
|
|
|
Options:
|
|
|
|
|
2014-02-19 01:32:13 +00:00
|
|
|
-rpc-addr=127.0.0.1:8400 RPC address of the Consul agent.
|
2014-06-11 18:08:19 +00:00
|
|
|
-wan Joins a server to another server in the WAN pool
|
2014-02-19 01:32:13 +00:00
|
|
|
|
2014-02-08 00:41:03 +00:00
|
|
|
```
|