Este contenido no está disponible en el idioma seleccionado.
Chapter 3. External Redis database configuration for high availability support in 3scale API Management
Red Hat supports 3scale configurations that use an external Redis database. However, does not officially support setting up Redis for zero downtime, configuring back-end components for 3scale, or Redis database replication and sharding. The content is for reference only. Additionally, Redis cluster mode
is not supported in 3scale.
High availability (HA) is provided for most components by the OpenShift Container Platform (OCP).
When you externalize databases from a Red Hat 3scale API Management deployment, this means to provide isolation from the application and resilience against service disruptions at the database level. The resilience to service disruptions depends on the service level agreements (SLAs) provided by the infrastructure or platform provider where you host the databases. This is not offered by 3scale. For more details on externalizing of databases offered by your chosen deployment, see the associated documentation.
The database components for HA in Red Hat 3scale API Management include:
-
backend-redis
: used for statistics storage and temporary job storage. -
system-redis
: provides temporary storage for background jobs for 3scale and is also used as a message bus for Ruby processes ofsystem-app
pods.
Both backend-redis
and system-redis
work with supported Redis high availability variants for Redis Sentinel and Redis Enterprise.
If the Redis pod comes to a stop, or if the OpenShift Container Platform stops it, a new pod is automatically created. Persistent storage will restore the data so the pod continues to work. In these scenarios, there will be a small amount of downtime while the new pod starts. This is due to a limitation in Redis that does not support a multi-master setup. You can reduce downtime by preinstalling the Redis images onto all nodes that have Redis deployed to them. This will speed up the pod restart time.
Set up Redis for zero downtime and configure back-end components for 3scale:
Prerequisites
- A 3scale account with an administrator role.
3.1. Setting up Redis for zero downtime Copiar enlaceEnlace copiado en el portapapeles!
As a 3scale administrator, configure Redis outside of OCP if you require zero downtime. There are several ways to set it up using the configuration options of 3scale pods:
- Set up your own self-managed Redis
- Use Redis Sentinel: Reference Redis Sentinel Documentation
Redis provided as a service:
For example by:
- Amazon ElastiCache
- Redis Labs
Red Hat does not provide support for the above mentioned services. The mention of any such services does not imply endorsement by Red Hat of the products or services. You agree that Red Hat is not responsible or liable for any loss or expenses that may result due to your use of (or reliance on) any external content.
3.2. Configuring back-end components for 3scale API Management Copiar enlaceEnlace copiado en el portapapeles!
As a 3scale administrator, configure Redis HA (failover) for the back-end
component environment variables in the following deployment configurations: backend-cron
, backend-listener
, and backend-worker
. These configurations are necessary for Redis HA in 3scale.
If you want to use Redis with sentinels, you must provide sentinel configuration in either backend-redis
, system-redis
, or both secrets.
3.2.1. Creating backend-redis and system-redis secrets Copiar enlaceEnlace copiado en el portapapeles!
Follow these steps to create backend-redis
and system-redis
secrets accordingly:
3.2.2. Deploying a fresh installation of 3scale API Management for HA Copiar enlaceEnlace copiado en el portapapeles!
Procedure
Create the
backend-redis
andsystem-redis
secrets with the fields below:backend-redis
Copy to Clipboard Copied! Toggle word wrap Toggle overflow system-redis
NAMESPACE SENTINEL_HOSTS SENTINEL_ROLE URL
NAMESPACE SENTINEL_HOSTS SENTINEL_ROLE URL
Copy to Clipboard Copied! Toggle word wrap Toggle overflow When configuring for Redis with sentinels, the corresponding
URL
fields inbackend-redis
andsystem-redis
refer to the Redis group in the formatredis://[:redis-password@]redis-group[/db]
, where [x] denotes optional element x andredis-password
,redis-group
, anddb
are variables to be replaced accordingly:Example
redis://:redispwd@mymaster/5
redis://:redispwd@mymaster/5
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The
SENTINEL_HOSTS
fields are comma-separated lists of sentinel connection strings in the following format:redis://:sentinel-password@sentinel-hostname-or-ip:port
redis://:sentinel-password@sentinel-hostname-or-ip:port
Copy to Clipboard Copied! Toggle word wrap Toggle overflow For each element of the list, [x] denotes optional element x and
sentinel-password
,sentinel-hostname-or-ip
, andport
are variables to be replaced accordingly:Example
:sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
:sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
-
The
SENTINEL_ROLE
fields are eithermaster
orslave
.
Deploy 3scale as indicated in Deploying 3scale API Management using the operator.
-
Ignore the errors due to
backend-redis
andsystem-redis
already present.
-
Ignore the errors due to
3.2.3. Migrating a non-HA deployment of 3scale API Management to HA Copiar enlaceEnlace copiado en el portapapeles!
-
Edit the
backend-redis
andsystem-redis
secrets with all fields as shown in Deploying a fresh installation of 3scale API Management for HA. Make sure the following
backend-redis
environment variables are defined for the back-end pods.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Make sure the following
system-redis
environment variables are defined for thesystem-(app|sidekiq)
pods.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Proceed with instructions to continue link:h:Link3scaleMigrating3scale: Upgrading 3scale using templates.
3.2.3.1. Using Redis Enterprise Copiar enlaceEnlace copiado en el portapapeles!
Use Redis Enterprise deployed in OpenShift, with three different
redis-enterprise
instances:Edit
system-redis
secret:-
Set the system redis database in
system-redis
toURL
.
-
Set the system redis database in
-
Set the back-end database in
backend-redis
toREDIS_QUEUES_URL
. -
Set the third database to
REDIS_STORAGE_URL
forbackend-redis
.
3.2.3.2. Using Redis Sentinel Copiar enlaceEnlace copiado en el portapapeles!
You can optionally apply Redis Sentinels to any of the databases. However, Red Hat recommends that you apply Redis Sentinels to all of them for HA.
Backend redis for statistics: update
backend-redis
secret and provide values for:-
REDIS_STORAGE_URL
-
REDIS_STORAGE_SENTINEL_ROLE
REDIS_STORAGE_SENTINEL_HOSTS
Set
REDIS_STORAGE_SENTINEL_ROLE
to a comma-separated list of sentinels hosts and ports, for example::sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
-
Backend redis for queue: update
backend-redis
secret and provide values for:-
REDIS_QUEUES_URL
-
REDIS_QUEUES_SENTINEL_ROLE
REDIS_QUEUES_SENTINEL_HOSTS
Set
REDIS_QUEUES_SENTINEL_ROLE
to a comma-separated list of sentinels hosts and ports, for example::sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
-
- Use Redis Sentinel, with these Redis databases:
System redis for data: update
system-redis
secret and provide values for:NoteEdit
system-redis
secret:URL
-
SENTINEL_ROLE
-
NAMESPACE
-
URL
SENTINEL_HOSTS
Set
SENTINEL_HOSTS
to a comma-separated list of sentinels hosts and ports, for example::sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
-
Notes
The system-app and system-sidekiq components connect directly to
back-end
Redis for retrieving statistics.-
As of 3scale 2.7, these system components can also connect to
back-end
Redis (storage) when using sentinels.
-
As of 3scale 2.7, these system components can also connect to
The system-app and system-sidekiq components uses only
backend-redis
storage, notbackend-redis
queues.-
Changes made to the system components support
backend-redis
storage with sentinels.
-
Changes made to the system components support
3.3. Additional information Copiar enlaceEnlace copiado en el portapapeles!
- For more information about 3scale and Redis database support, see Red Hat 3scale API Management Supported Configurations.
- For more information about Amazon ElastiCache for Redis, see the official Amazon ElastiCache Documentation.
- For more information about Redis Enterprise, see the latest Documentation.