website: agent getting started modifications
This commit is contained in:
parent
3b0e397851
commit
3e9ef7a122
|
@ -7,8 +7,8 @@ sidebar_current: "gettingstarted-agent"
|
|||
# Run the Consul Agent
|
||||
|
||||
After Consul is installed, the agent must be run. The agent can either run
|
||||
in a server or client mode. Each datacenter must at least one server, and
|
||||
a recommended 3 or 5. A single server deployment is _**highly**_ discouraged
|
||||
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. [This guide](/docs/guides/bootstrapping.html)
|
||||
covers bootstrapping a new datacenter. All other agents run in client mode, which
|
||||
is a very lightweight process that registers services, runs health checks,
|
||||
|
@ -20,7 +20,7 @@ will be part of the cluster.
|
|||
For simplicity, we'll run a single Consul agent in server mode right now:
|
||||
|
||||
```
|
||||
$ ./bin/consul agent -server -bootstrap -data-dir /tmp/consul
|
||||
$ consul agent -server -bootstrap -data-dir /tmp/consul
|
||||
==> WARNING: Bootstrap mode enabled! Do not enable unless necessary
|
||||
==> WARNING: It is highly recommended to set GOMAXPROCS higher than 1
|
||||
==> Starting Consul agent...
|
||||
|
@ -63,40 +63,33 @@ $ consul members
|
|||
Armons-MacBook-Air 10.1.10.38:8301 alive role=consul,dc=dc1,vsn=1,vsn_min=1,vsn_max=1,port=8300,bootstrap=1
|
||||
```
|
||||
|
||||
This command, along with many others, communicates with a running Consul
|
||||
agent via an internal RPC protocol. When starting the Consul agent, you
|
||||
may have noticed that it tells you the "RPC addr". This is the address
|
||||
that commands such as `consul members` use to communicate with the agent.
|
||||
The output shows our own node, the address it is running on, its
|
||||
health state, and some metadata associated with the node. Some important
|
||||
metadata keys to recognize are the `role` and `dc` keys. These tell you
|
||||
the service name and the datacenter that member is within. These can be
|
||||
used to lookup nodes and services using the DNS interface, which is covered
|
||||
shortly.
|
||||
|
||||
By default, RPC listens only on loopback, so it is inaccessible outside
|
||||
of your machine for security reasons.
|
||||
|
||||
If you're changed the default RPC address, you'll have to specify
|
||||
an `-rpc-addr` to both the agent and any commands so that it doesn't
|
||||
collide with other agents.
|
||||
|
||||
It is important to note that the output of the `members` command is
|
||||
generated by from the [gossip protocol](/docs/internals/gossip.html),
|
||||
and is eventually consistent. Consul uses this to maintain a strongly
|
||||
consistent catalog of nodes that can be queried using the [HTTP API](/docs/agent/http.html):
|
||||
The output from the `members` command is generated based on the
|
||||
[gossip protocol](/docs/internals/gossip.html) and is eventually consistent.
|
||||
For a strongly consistent view of the world, use the
|
||||
[HTTP API](/docs/agent/http.html), which forwards the request to the
|
||||
Consul servers:
|
||||
|
||||
```
|
||||
$ curl localhost:8500/v1/catalog/nodes
|
||||
[{"Node":"Armons-MacBook-Air","Address":"10.1.10.38"}]
|
||||
```
|
||||
|
||||
Alternatively, the [DNS interface](/docs/agent/dns.html) could be used:
|
||||
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 later.
|
||||
|
||||
```
|
||||
$ dig @127.0.0.1 -p 8600 Armons-MacBook-Air.node.consul
|
||||
|
||||
; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 -p 8600 Armons-MacBook-Air.node.consul
|
||||
; (1 server found)
|
||||
;; global options: +cmd
|
||||
;; Got answer:
|
||||
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63911
|
||||
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
|
||||
;; WARNING: recursion requested but not available
|
||||
...
|
||||
|
||||
;; QUESTION SECTION:
|
||||
;Armons-MacBook-Air.node.consul. IN A
|
||||
|
|
Loading…
Reference in New Issue