mirror of https://github.com/status-im/consul.git
Website: improve flow between getting-started docs.
This commit is contained in:
parent
c248ba1b53
commit
86ec73513c
|
@ -3,24 +3,26 @@ layout: "intro"
|
||||||
page_title: "Run the Agent"
|
page_title: "Run the Agent"
|
||||||
sidebar_current: "gettingstarted-agent"
|
sidebar_current: "gettingstarted-agent"
|
||||||
description: |-
|
description: |-
|
||||||
After Consul is installed, the agent must be run. The agent can either run in a server or client mode. Each datacenter must have at least one server, although 3 or 5 is recommended. A single server deployment is highly discouraged as data loss is inevitable in a failure scenario.
|
After Consul is installed, the agent must be run. The agent can either run in server or client mode. Each datacenter must have at least one server, though a cluster of 3 or 5 servers is recommended. A single server deployment is highly discouraged as data loss is inevitable in a failure scenario.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Run the Consul Agent
|
# Run the Consul Agent
|
||||||
|
|
||||||
After Consul is installed, the agent must be run. The agent can run either
|
After Consul is installed, the agent must be run. The agent can run either
|
||||||
in server or client mode. Each datacenter must have at least one server,
|
in server or client mode. Each datacenter must have at least one server,
|
||||||
although 3 or 5 is recommended. A single server deployment is _**highly**_ discouraged
|
though a cluster of 3 or 5 servers is recommended. A single server deployment
|
||||||
as data loss is inevitable in a failure scenario. [This guide](/docs/guides/bootstrapping.html)
|
is _**highly**_ discouraged as data loss is inevitable in a failure scenario.
|
||||||
covers bootstrapping a new datacenter.
|
|
||||||
|
|
||||||
All other agents run in client mode, a very lightweight
|
All other agents run in client mode. A client is a very lightweight
|
||||||
process that registers services, runs health checks, and forwards queries to
|
process that registers services, runs health checks, and forwards queries to
|
||||||
servers. The agent must be run on every node that is part of the cluster.
|
servers. The agent must be run on every node that is part of the cluster.
|
||||||
|
|
||||||
|
For more detail on bootstrapping a datacenter, see
|
||||||
|
[this guide](/docs/guides/bootstrapping.html).
|
||||||
|
|
||||||
## Starting the Agent
|
## Starting the Agent
|
||||||
|
|
||||||
For simplicity, we'll run a single Consul agent in server mode right now:
|
For simplicity, we'll run a single Consul agent in server mode:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
|
$ consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul
|
||||||
|
@ -63,9 +65,9 @@ the name of your node with the `-node` flag.
|
||||||
|
|
||||||
## Cluster Members
|
## Cluster Members
|
||||||
|
|
||||||
If you run `consul members` in another terminal, you can see the members of
|
If you run [`consul members`](/docs/commands/members.html) in another terminal, you
|
||||||
the Consul cluster. We'll cover joining clusters in the next section, but for now,
|
can see the members of the Consul cluster. We'll cover joining clusters in the next
|
||||||
you should only see one member (yourself):
|
section, but for now, you should only see one member (yourself):
|
||||||
|
|
||||||
```text
|
```text
|
||||||
$ consul members
|
$ consul members
|
||||||
|
@ -77,8 +79,8 @@ The output shows our own node, the address it is running on, its
|
||||||
health state, its role in the cluster, and some version information.
|
health state, its role in the cluster, and some version information.
|
||||||
Additional metadata can be viewed by providing the `-detailed` flag.
|
Additional metadata can be viewed by providing the `-detailed` flag.
|
||||||
|
|
||||||
The output of the `members` command is based on the
|
The output of the [`members`](/docs/commands/members.html) command is based on
|
||||||
[gossip protocol](/docs/internals/gossip.html) and is eventually consistent.
|
the [gossip protocol](/docs/internals/gossip.html) and is eventually consistent.
|
||||||
That is, at any point in time, the view of the world as seen by your local
|
That is, at any point in time, the view of the world as seen by your local
|
||||||
agent may not exactly match the state on the servers. For a strongly consistent
|
agent may not exactly match the state on the servers. For a strongly consistent
|
||||||
view of the world, use the [HTTP API](/docs/agent/http.html) as it forwards the
|
view of the world, use the [HTTP API](/docs/agent/http.html) as it forwards the
|
||||||
|
@ -89,12 +91,11 @@ $ curl localhost:8500/v1/catalog/nodes
|
||||||
[{"Node":"Armons-MacBook-Air","Address":"10.1.10.38"}]
|
[{"Node":"Armons-MacBook-Air","Address":"10.1.10.38"}]
|
||||||
```
|
```
|
||||||
|
|
||||||
In addition to the HTTP API, the
|
In addition to the HTTP API, the [DNS interface](/docs/agent/dns.html) can
|
||||||
[DNS interface](/docs/agent/dns.html) can be used to query the node. Note
|
be used to query the node. Note that you have to make sure to point your DNS
|
||||||
that you have to make sure to point your DNS lookups to the Consul agent's
|
lookups to the Consul agent's DNS server which runs on port 8600 by default.
|
||||||
DNS server which runs on port 8600 by default. The format of the DNS
|
The format of the DNS entries (such as "Armons-MacBook-Air.node.consul") will
|
||||||
entries (such as "Armons-MacBook-Air.node.consul") will be covered in more
|
be covered in more detail later.
|
||||||
detail later.
|
|
||||||
|
|
||||||
```text
|
```text
|
||||||
$ dig @127.0.0.1 -p 8600 Armons-MacBook-Air.node.consul
|
$ dig @127.0.0.1 -p 8600 Armons-MacBook-Air.node.consul
|
||||||
|
@ -122,6 +123,12 @@ Consul will automatically try to reconnect to _failed_ nodes, allowing it
|
||||||
to recover from certain network conditions, while _left_ nodes are no longer contacted.
|
to recover from certain network conditions, while _left_ nodes are no longer contacted.
|
||||||
|
|
||||||
Additionally, if an agent is operating as a server, a graceful leave is important
|
Additionally, if an agent is operating as a server, a graceful leave is important
|
||||||
to avoid causing a potential availability outage affecting the [consensus protocol](/docs/internals/consensus.html).
|
to avoid causing a potential availability outage affecting the
|
||||||
See the [guides section](/docs/guides/index.html) for details on how to safely add
|
[consensus protocol](/docs/internals/consensus.html). See the
|
||||||
|
[guides section](/docs/guides/index.html) for details on how to safely add
|
||||||
and remove servers.
|
and remove servers.
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
Your simple Consul cluster is up and running. Let's give it some
|
||||||
|
[services](services.html)!
|
||||||
|
|
|
@ -72,4 +72,7 @@ environment variable was not set up properly. Please go back and ensure
|
||||||
that your `PATH` variable contains the directory where Consul was
|
that your `PATH` variable contains the directory where Consul was
|
||||||
installed.
|
installed.
|
||||||
|
|
||||||
Otherwise, Consul is installed and ready to go!
|
## Next Steps
|
||||||
|
|
||||||
|
Consul is installed and ready for operation. Let's
|
||||||
|
[run the agent](agent.html)!
|
||||||
|
|
Loading…
Reference in New Issue