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"
|
||||
sidebar_current: "gettingstarted-agent"
|
||||
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
|
||||
|
||||
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,
|
||||
although 3 or 5 is recommended. A single server deployment is _**highly**_ discouraged
|
||||
as data loss is inevitable in a failure scenario. [This guide](/docs/guides/bootstrapping.html)
|
||||
covers bootstrapping a new datacenter.
|
||||
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.
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
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
|
||||
$ 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
|
||||
|
||||
If you run `consul members` in another terminal, you can see the members of
|
||||
the Consul cluster. We'll cover joining clusters in the next section, but for now,
|
||||
you should only see one member (yourself):
|
||||
If you run [`consul members`](/docs/commands/members.html) in another terminal, you
|
||||
can see the members of the Consul cluster. We'll cover joining clusters in the next
|
||||
section, but for now, you should only see one member (yourself):
|
||||
|
||||
```text
|
||||
$ 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.
|
||||
Additional metadata can be viewed by providing the `-detailed` flag.
|
||||
|
||||
The output of the `members` command is based on the
|
||||
[gossip protocol](/docs/internals/gossip.html) and is eventually consistent.
|
||||
The output of the [`members`](/docs/commands/members.html) command is based on
|
||||
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
|
||||
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
|
||||
|
@ -89,12 +91,11 @@ $ curl localhost:8500/v1/catalog/nodes
|
|||
[{"Node":"Armons-MacBook-Air","Address":"10.1.10.38"}]
|
||||
```
|
||||
|
||||
In addition to the HTTP API, the
|
||||
[DNS interface](/docs/agent/dns.html) can be used to query the node. Note
|
||||
that you have to make sure to point your DNS lookups to the Consul agent's
|
||||
DNS server which runs on port 8600 by default. The format of the DNS
|
||||
entries (such as "Armons-MacBook-Air.node.consul") will be covered in more
|
||||
detail later.
|
||||
In addition to the HTTP API, the [DNS interface](/docs/agent/dns.html) can
|
||||
be used to query the node. Note that you have to make sure to point your DNS
|
||||
lookups to the Consul agent's DNS server which runs on port 8600 by default.
|
||||
The format of the DNS entries (such as "Armons-MacBook-Air.node.consul") will
|
||||
be covered in more detail later.
|
||||
|
||||
```text
|
||||
$ 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.
|
||||
|
||||
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).
|
||||
See the [guides section](/docs/guides/index.html) for details on how to safely add
|
||||
to avoid causing a potential availability outage affecting the
|
||||
[consensus protocol](/docs/internals/consensus.html). See the
|
||||
[guides section](/docs/guides/index.html) for details on how to safely add
|
||||
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
|
||||
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