2014-02-08 00:41:03 +00:00
|
|
|
---
|
2020-04-07 18:55:19 +00:00
|
|
|
layout: docs
|
2020-09-01 15:14:13 +00:00
|
|
|
page_title: Upgrade Consul
|
2020-04-07 18:55:19 +00:00
|
|
|
description: >-
|
|
|
|
Consul is meant to be a long-running agent on any nodes participating in a
|
|
|
|
Consul cluster. These nodes consistently communicate with each other. As such,
|
|
|
|
protocol level compatibility and ease of upgrades is an important thing to
|
|
|
|
keep in mind when using Consul.
|
2014-02-08 00:41:03 +00:00
|
|
|
---
|
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
# Upgrading Consul
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
Consul is meant to be a long-running agent on any nodes participating in a
|
|
|
|
Consul cluster. These nodes consistently communicate with each other. As such,
|
2014-02-08 00:41:03 +00:00
|
|
|
protocol level compatibility and ease of upgrades is an important thing to
|
2014-02-19 01:37:23 +00:00
|
|
|
keep in mind when using Consul.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
This page documents how to upgrade Consul when a new version is released.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2023-01-25 16:52:43 +00:00
|
|
|
-> **Tip:** For Consul Enterprise, see the [Automated Upgrades documentation](/consul/docs/enterprise/upgrades).
|
2021-03-30 00:02:42 +00:00
|
|
|
|
2014-06-11 18:25:55 +00:00
|
|
|
## Standard Upgrades
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-06-11 18:25:55 +00:00
|
|
|
For upgrades we strive to ensure backwards compatibility. To support this,
|
|
|
|
nodes gossip their protocol version and builds. This enables clients and
|
|
|
|
servers to intelligently enable new features when available, or to gracefully
|
|
|
|
fallback to a backward compatible mode of operation otherwise.
|
2023-01-25 16:52:43 +00:00
|
|
|
Visit the [General Upgrade Process](/consul/docs/upgrading/instructions/general-process) for a detailed upgrade guide.
|
2014-06-11 18:25:55 +00:00
|
|
|
|
|
|
|
For most upgrades, the process is simple. Assuming the current version of
|
|
|
|
Consul is A, and version B is released.
|
|
|
|
|
2023-01-25 16:52:43 +00:00
|
|
|
1. Check the [version's upgrade notes](/consul/docs/upgrading/upgrade-specific) to ensure
|
2018-10-11 10:38:55 +00:00
|
|
|
there are no compatibility issues that will affect your workload. If there
|
|
|
|
are plan accordingly before continuing.
|
2014-06-11 18:25:55 +00:00
|
|
|
|
2022-07-01 13:24:53 +00:00
|
|
|
2. On each Consul server agent, install version B of Consul.
|
2014-06-11 18:25:55 +00:00
|
|
|
|
2023-07-12 16:56:38 +00:00
|
|
|
3. One Consul server agent at a time, use a service management system
|
|
|
|
(e.g., systemd, upstart, etc.) to restart the Consul service with version B. Wait until
|
2022-07-01 13:24:53 +00:00
|
|
|
the server agent is healthy and has rejoined the cluster before moving on to the
|
|
|
|
next server agent.
|
2018-10-11 10:38:55 +00:00
|
|
|
|
2022-07-01 13:24:53 +00:00
|
|
|
4. Once all the server agents are upgraded, begin a rollout of client agents following
|
2014-06-11 18:25:55 +00:00
|
|
|
the same process.
|
|
|
|
|
2022-07-01 13:24:53 +00:00
|
|
|
-> **Upgrade Envoy proxies:** If a client agent has associated Envoy proxies (e.g., sidecars, gateways),
|
2023-01-25 16:52:43 +00:00
|
|
|
install a [compatible Envoy version](/consul/docs/connect/proxies/envoy#supported-versions)
|
2022-07-01 13:24:53 +00:00
|
|
|
for Consul version B.
|
|
|
|
After stopping client agent version A,
|
|
|
|
stop its associated Envoy proxies.
|
|
|
|
After restarting the client agent with version B,
|
|
|
|
restart its associated Envoy proxies with the compatible Envoy version.
|
|
|
|
|
2018-10-11 10:38:55 +00:00
|
|
|
5. Done! You are now running the latest Consul agent. You can verify this
|
2014-06-11 18:25:55 +00:00
|
|
|
by running `consul members` to make sure all members have the latest
|
|
|
|
build and highest protocol version.
|
|
|
|
|
2024-02-26 20:27:59 +00:00
|
|
|
## Upgrade recommendation
|
|
|
|
|
|
|
|
We encourage organizations to use a maintained version of Consul
|
|
|
|
so that they benefit from bug and security fixes in minor releases.
|
2024-03-18 23:06:39 +00:00
|
|
|
|
|
|
|
### Consul community edition
|
2024-02-26 20:27:59 +00:00
|
|
|
|
|
|
|
For Consul community edition users,
|
2024-03-18 23:06:39 +00:00
|
|
|
consistently operating a maintained version requires upgrading
|
|
|
|
every 4 months to the latest major release.
|
|
|
|
|
|
|
|
### Consul Enterprise
|
|
|
|
|
|
|
|
Standard major releases of Consul Enterprise are maintained for approximately 1 year.
|
|
|
|
[Consul Enterprise Long Term Support (LTS)](/consul/docs/enterprise/long-term-support)
|
|
|
|
releases are maintained for approximately 2 years.
|
2024-02-26 20:27:59 +00:00
|
|
|
|
|
|
|
For Consul Enterprise customers,
|
|
|
|
consistently operating a maintained version requires a major upgrade every 12 months
|
|
|
|
on average when using [LTS](/consul/docs/enterprise/long-term-support) releases.
|
|
|
|
LTS releases support an upgrade jump of at most 3 major versions.
|
|
|
|
For more details, refer to
|
|
|
|
[Long Term Support upgrade recommendation](/consul/docs/enterprise/long-term-support#annual-upgrade-to-next-lts-release).
|
|
|
|
|
2020-09-14 17:18:08 +00:00
|
|
|
## Large Version Jumps
|
|
|
|
|
2024-02-26 20:27:59 +00:00
|
|
|
If your Consul deployment is many major versions behind the latest release
|
|
|
|
and you need to upgrade, review our
|
|
|
|
[upgrade instructions](/consul/docs/upgrading/instructions)
|
|
|
|
for more information about how to perform those upgrades.
|
|
|
|
|
|
|
|
After upgrading to a maintained version of Consul, refer to our
|
|
|
|
[upgrade recommendation](#upgrade-recommendation)
|
|
|
|
to inform planning for future upgrades.
|
2020-09-14 17:18:08 +00:00
|
|
|
|
2014-06-11 18:25:55 +00:00
|
|
|
## Backward Incompatible Upgrades
|
|
|
|
|
|
|
|
In some cases, a backwards incompatible update may be released. This has not
|
|
|
|
been an issue yet, but to support upgrades we support setting an explicit
|
|
|
|
protocol version. This disables incompatible features and enables a 2-phase upgrade.
|
|
|
|
|
|
|
|
For the steps below, assume you're running version A of Consul, and then
|
|
|
|
version B comes out.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
1. On each node, install version B of Consul.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2019-05-01 13:49:05 +00:00
|
|
|
2. One server at a time, shut down version A via `consul leave` and start version B with the
|
2018-10-11 10:44:20 +00:00
|
|
|
`-protocol=PREVIOUS` flag, where "PREVIOUS" is the protocol version of
|
2020-04-06 20:27:35 +00:00
|
|
|
version A (which can be discovered by running `consul -v` or `consul members`). Wait until the server is healthy and has rejoined the cluster
|
2018-10-11 10:44:20 +00:00
|
|
|
before moving on to the next server.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2018-10-11 10:44:20 +00:00
|
|
|
3. Once all nodes are running version B, go through every node and restart the
|
|
|
|
version B agent _without_ the `-protocol` flag, again wait for each server to
|
|
|
|
rejoin the cluster before continuing.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
4. Done! You're now running the latest Consul agent speaking the latest protocol.
|
2014-03-09 22:57:03 +00:00
|
|
|
You can verify this is the case by running `consul members` to
|
2014-02-08 00:41:03 +00:00
|
|
|
make sure all members are speaking the same, latest protocol version.
|
|
|
|
|
2023-01-25 16:52:43 +00:00
|
|
|
The key to making this work is the [protocol compatibility](/consul/docs/upgrading/compatibility)
|
2014-02-19 01:37:23 +00:00
|
|
|
of Consul. The protocol version system is discussed below.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
|
|
|
## Protocol Versions
|
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
By default, Consul agents speak the latest protocol they can. However, each
|
|
|
|
new version of Consul is also able to speak the previous protocol, if there
|
2014-02-08 00:41:03 +00:00
|
|
|
were any protocol changes.
|
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
You can see what protocol versions your version of Consul understands by
|
|
|
|
running `consul -v`. You'll see output similar to that below:
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2014-02-19 01:37:23 +00:00
|
|
|
$ consul -v
|
2016-08-26 00:12:02 +00:00
|
|
|
Consul v0.7.0
|
|
|
|
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
|
2014-02-08 00:41:03 +00:00
|
|
|
```
|
|
|
|
|
2016-08-16 21:15:13 +00:00
|
|
|
This says the version of Consul as well as the protocol versions this
|
2016-08-17 18:29:09 +00:00
|
|
|
agent speaks and can understand.
|
2016-08-16 21:15:13 +00:00
|
|
|
|
2016-11-25 16:00:02 +00:00
|
|
|
Sometimes Consul will default to speak a lower protocol version
|
2016-08-16 21:15:13 +00:00
|
|
|
than it understands, in order to ease compatibility with older agents. For
|
|
|
|
example, Consul agents that understand version 3 claim to speak version 2,
|
|
|
|
and only send version 3 messages to agents that understand version 3. This
|
|
|
|
allows features to upshift automatically as agents are upgraded, and is the
|
|
|
|
strategy used whenever possible. If this is not possible, then you will need
|
|
|
|
to do a backward incompatible upgrade using the instructions above, and such
|
|
|
|
a requirement will be clearly outlined in the notes for a given release.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-02-19 01:37:23 +00:00
|
|
|
By specifying the `-protocol` flag on `consul agent`, you can tell the
|
|
|
|
Consul agent to speak any protocol version that it can understand. This
|
|
|
|
only specifies the protocol version to _speak_. Every Consul agent can
|
2014-02-08 00:41:03 +00:00
|
|
|
always understand the entire range of protocol versions it claims to
|
2014-02-19 01:37:23 +00:00
|
|
|
on `consul -v`.
|
2014-02-08 00:41:03 +00:00
|
|
|
|
2014-10-19 23:40:10 +00:00
|
|
|
~> **By running a previous protocol version**, some features
|
2014-02-19 01:37:23 +00:00
|
|
|
of Consul, especially newer features, may not be available. If this is the
|
|
|
|
case, Consul will typically warn you. In general, you should always upgrade
|
2014-02-08 00:41:03 +00:00
|
|
|
your cluster so that you can run the latest protocol version.
|
2019-12-19 02:02:26 +00:00
|
|
|
|
|
|
|
## Upgrading on Kubernetes
|
|
|
|
|
2023-01-25 16:52:43 +00:00
|
|
|
See the dedicated [Upgrading Consul on Kubernetes](/consul/docs/k8s/upgrade) page.
|
2021-01-22 17:07:23 +00:00
|
|
|
|
|
|
|
## Upgrading federated datacenters
|
|
|
|
|
|
|
|
If you need to upgrade a federated environment with multiple datacenters you can
|
2023-01-25 16:52:43 +00:00
|
|
|
refer to the [Upgrade Multiple Federated Consul Datacenters](/consul/tutorials/datacenter-operations/upgrade-federated-environment)
|
2021-01-22 17:07:23 +00:00
|
|
|
tutorial.
|