Downgrade from Consul Enterprise to the community edition
This document describes how to downgrade from Consul Enterprise to Consul community edition (CE).
Overview
You can downgrade Consul editions if you no longer require Consul Enterprise features. Complete the following steps to downgrade to Consul CE:
- Download the CE binary.
- Backup your Consul data and set appropriate log levels.
- Complete the downgrade procedures.
Request-handling details
During the downgrade process, the Consul CE server handles the raft replication logs in one of the following ways:
- Drops the request.
- Filters out data from requests sent from non-default namespaces or partitions.
- Panics and stops the downgrade.
The following examples describe scenarios where the server may drop the requests:
Registration requests in non-default namespace
Services or health checks in non-default namespaces or partitions.
Write requests to peered clusters if the local partition connecting to the peer is non-default.
The following examples describe scenarios where the server may filter out data from requests:
- Intention sources that target non-default namespaces or partitions are filtered out of the configuration entry.
- Exports of services within non-default namespaces or partitions are filtered out of the configuration entry.
The server may panic and stop the downgrade when Consul cannot safely filter configuration entries that route traffic. This is because Consul is unable to determine if the filtered configuration entries send traffic to services that are able to handle the traffic. Consul CE panics in order to prevent harm to existing service mesh routes.
In these situations, you must first remove references to services within non-default namespaces or partitions from those configuration entries.
The server may panic in the following cases:
- Service splitter, service resolver, and service router configuration entry requests that have references to services located in non-default namespaces or partitions cause the server to panic.
Requirements
You can only downgrade Consul editions for v1.18 and later.
Download the CE binary version
First, download the binary for CE.
All current and past versions of the CE and Enterprise releases are available on the HashiCorp releases page
Example:
Prepare for the downgrade to CE
Take a snapshot of the existing Consul state so that you have a safe fallback if an error occurs.
Run the following command to verify that the snapshot was successfully saved:
Example output:
Store the snapshot in a safe location. Refer to the following documentation for additional information about using snapshots:
Temporarily modify your Consul configuration so that its log_level is set to
debug
. This enables Consul to report detailed information if an error occurs.Issue the following command on your servers to reload the configuration:
If applicable, modify the following configuration entries:
- Service resolver:
- Remove services configured as failovers in non-default namespaces or services that belong to a sameness group.
- Remove services configured as redirects that belong to non-default namespaces or partitions.
- Service splitter:
- Remove services configured as splits that belong to non-default namespaces or partitions.
- Service router:
- Remove services configured as a destination that belong to non-default namespaces or partitions.
- Service resolver:
Perform the downgrade
Restart or redeploy all Consul clients with a CE version of the binary. You can use a service management system, such as
systemd
orupstart
, to restart the Consul service. If you are not using a service management system, you must restart the agent manually. The following example usessystemctl
to restart the Consul service:Issue the following command to discover which server is currently the leader:
Consul prints the raft information. The format and content may differ based on your version of Consul:
Make a note of the leader so that you can perform the downgrade on agents in the proper order.
Update the server binaries to use the CE version. Complete the following steps in order for each server agent in the
follower
state. Then, repeat the steps for theleader
agent.- Set an environment variable named
CONSUL_ENTERPRISE_DOWNGRADE_TO_CE
totrue
. The following example sets variable usingsystemd
:- Edit the Consul systemd service unit file:
- Add the environment variables you want to set for Consul under the
[Service]
section of the unit file and save the changes: - Reload
systemd
:
- Edit the Consul systemd service unit file:
- Restart the Consul service. You can use a service management system, such as
systemd
orupstart
. If you are not using a service management system, you must restart the agent manually. The following example restarts Consul usingsystemctl
: - To validate that the agent has rejoined the cluster and is in sync with the leader, issue the following command:Verify that the
commit_index
andlast_log_index
fields have the same value. Differing values may be result of an unexpected leadership election due to loss of quorum.
- Set an environment variable named
Run the following command to verify that all servers appear in the cluster as expected and are on the correct version:
Consul prints cluster membership information. The exact format and content depends on your Consul version:
Verify the raft state to make sure there is a leader and sufficient voters:
Consul prints the raft information. The format and content may differ based on your version of Consul:
Set your
log_level
back to its original value and issue the following command on your servers to reload the configuration: