2014-02-08 00:41:03 +00:00
|
|
|
---
|
2020-04-07 18:55:19 +00:00
|
|
|
layout: intro
|
|
|
|
page_title: Introduction
|
|
|
|
sidebar_title: 'What is Consul?'
|
|
|
|
sidebar_current: what
|
|
|
|
description: >-
|
|
|
|
Welcome to the intro guide to Consul! This guide is the best place to start
|
|
|
|
with Consul. We cover what Consul is, what problems it can solve, how it
|
|
|
|
compares to existing software, and how you can get started using it. If you
|
|
|
|
are familiar with the basics of Consul, the documentation provides a more
|
|
|
|
detailed reference of available features.
|
2014-02-08 00:41:03 +00:00
|
|
|
---
|
|
|
|
|
2014-04-10 20:31:47 +00:00
|
|
|
# Introduction to Consul
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-04-19 09:55:59 +00:00
|
|
|
Welcome to the intro guide to Consul! This guide is the best place to start
|
2014-04-10 20:31:47 +00:00
|
|
|
with Consul. We cover what Consul is, what problems it can solve, how it compares
|
2015-02-18 21:45:10 +00:00
|
|
|
to existing software, and how you can get started using it. If you are familiar
|
2020-04-09 23:20:00 +00:00
|
|
|
with the basics of Consul, the [documentation](/docs) provides a more
|
2015-02-18 21:45:10 +00:00
|
|
|
detailed reference of available features.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-04-10 20:31:47 +00:00
|
|
|
## What is Consul?
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2018-06-26 19:52:27 +00:00
|
|
|
Consul is a service mesh solution providing a full featured control plane
|
|
|
|
with service discovery, configuration, and segmentation functionality. Each
|
|
|
|
of these features can be used individually as needed, or they can be used
|
|
|
|
together to build a full service mesh. Consul requires a data plane and
|
|
|
|
supports both a proxy and native integration model. Consul ships with a
|
|
|
|
simple built-in proxy so that everything works out of the box, but also
|
|
|
|
supports 3rd party proxy integrations such as Envoy.
|
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
Review the video below to learn more about Consul from HashiCorp's co-founder Armon.
|
2019-12-18 18:54:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
<iframe
|
|
|
|
src="https://www.youtube.com/embed/mxeMdl0KvBI"
|
|
|
|
frameborder="0"
|
|
|
|
allowfullscreen="true"
|
|
|
|
width="560"
|
|
|
|
height="315"
|
|
|
|
></iframe>
|
2019-12-18 18:54:39 +00:00
|
|
|
|
2018-06-26 19:52:27 +00:00
|
|
|
The key features of Consul are:
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
- **Service Discovery**: Clients of Consul can register a service, such as
|
2018-06-19 06:14:02 +00:00
|
|
|
`api` or `mysql`, and other clients can use Consul to discover providers
|
2014-04-10 20:31:47 +00:00
|
|
|
of a given service. Using either DNS or HTTP, applications can easily find
|
|
|
|
the services they depend upon.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
- **Health Checking**: Consul clients can provide any number of health checks,
|
2014-04-10 20:31:47 +00:00
|
|
|
either associated with a given service ("is the webserver returning 200 OK"), or
|
|
|
|
with the local node ("is memory utilization below 90%"). This information can be
|
|
|
|
used by an operator to monitor cluster health, and it is used by the service
|
|
|
|
discovery components to route traffic away from unhealthy hosts.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
- **KV Store**: Applications can make use of Consul's hierarchical key/value
|
2015-02-18 21:45:10 +00:00
|
|
|
store for any number of purposes, including dynamic configuration, feature flagging,
|
|
|
|
coordination, leader election, and more. The simple HTTP API makes it easy to use.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
- **Secure Service Communication**: Consul can generate and distribute TLS
|
2018-06-19 06:14:02 +00:00
|
|
|
certificates for services to establish mutual TLS connections.
|
|
|
|
[Intentions](/docs/connect/intentions.html)
|
2018-06-19 11:31:27 +00:00
|
|
|
can be used to define which services are allowed to communicate.
|
2018-06-20 06:03:02 +00:00
|
|
|
Service segmentation can be easily managed with intentions that can
|
|
|
|
be changed in real time instead of using complex network topologies
|
|
|
|
and static firewall rules.
|
2018-06-19 06:14:02 +00:00
|
|
|
|
2020-04-06 20:27:35 +00:00
|
|
|
- **Multi Datacenter**: Consul supports multiple datacenters out of the box. This
|
2014-04-10 20:31:47 +00:00
|
|
|
means users of Consul do not have to worry about building additional layers of
|
|
|
|
abstraction to grow to multiple regions.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-04-14 21:08:42 +00:00
|
|
|
Consul is designed to be friendly to both the DevOps community and
|
|
|
|
application developers, making it perfect for modern, elastic infrastructures.
|
|
|
|
|
2014-04-14 19:09:32 +00:00
|
|
|
## Basic Architecture of Consul
|
|
|
|
|
2015-02-18 21:45:10 +00:00
|
|
|
Consul is a distributed, highly available system. This section will cover the
|
|
|
|
basics, purposely omitting some unnecessary detail, so you can get a quick
|
|
|
|
understanding of how Consul works. For more detail, please refer to the
|
|
|
|
[in-depth architecture overview](/docs/internals/architecture.html).
|
2014-04-14 19:09:32 +00:00
|
|
|
|
|
|
|
Every node that provides services to Consul runs a _Consul agent_. Running
|
|
|
|
an agent is not required for discovering other services or getting/setting
|
|
|
|
key/value data. The agent is responsible for health checking the services
|
|
|
|
on the node as well as the node itself.
|
|
|
|
|
|
|
|
The agents talk to one or more _Consul servers_. The Consul servers are
|
|
|
|
where data is stored and replicated. The servers themselves elect a leader.
|
|
|
|
While Consul can function with one server, 3 to 5 is recommended to avoid
|
2015-02-18 21:45:10 +00:00
|
|
|
failure scenarios leading to data loss. A cluster of Consul servers is recommended
|
|
|
|
for each datacenter.
|
2014-04-14 19:09:32 +00:00
|
|
|
|
2020-02-14 14:27:37 +00:00
|
|
|
The servers maintain a _catalog_, which is formed by aggregating information
|
|
|
|
submitted by the agents. The catalog maintains the high-level view of the cluster,
|
2020-04-06 20:27:35 +00:00
|
|
|
including which services are available, which nodes run those services, health
|
|
|
|
information, and more. How agents and the catalog interact can be found
|
2020-02-14 14:27:37 +00:00
|
|
|
[here](/docs/internals/anti-entropy.html#catalog).
|
|
|
|
|
2014-04-14 19:09:32 +00:00
|
|
|
Components of your infrastructure that need to discover other services
|
|
|
|
or nodes can query any of the Consul servers _or_ any of the Consul agents.
|
|
|
|
The agents forward queries to the servers automatically.
|
|
|
|
|
|
|
|
Each datacenter runs a cluster of Consul servers. When a cross-datacenter
|
|
|
|
service discovery or configuration request is made, the local Consul servers
|
|
|
|
forward the request to the remote datacenter and return the result.
|
|
|
|
|
|
|
|
## Next Steps
|
|
|
|
|
2020-04-09 23:20:00 +00:00
|
|
|
- See [how Consul compares to other software](/intro/vs) to assess how it fits into your
|
2020-04-06 20:27:35 +00:00
|
|
|
existing infrastructure.
|
|
|
|
- Continue onwards with the [getting started guide](https://learn.hashicorp.com/consul/getting-started/install)
|
|
|
|
to get Consul up and running.
|