Este conteúdo não está disponível no idioma selecionado.
Chapter 8. Redis high availability (HA) support for 3scale
High availability (HA) is provided for most components by the OpenShift Container Platform (OCP). For more information see OpenShift Container Platform 3.11 Chapter 30. High Availability.
The information and procedures in this section is not officially supported by Red Hat. It is for reference only.
			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 of system-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.
To set up Redis for zero downtime and configure back-end components for 3scale, perform the steps outlined in the following sections:
8.1. Setting up Redis for zero downtime
If zero downtime is required, you must configure Redis outside of OCP. 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.
8.2. Configuring back-end components for 3scale
				There are configuration settings in 3scale 2.7 to configure Redis HA (failover) for the back-end component. You can configure these settings as environment variables in the following deployment configurations: backend-cron, backend-listener, and backend-worker.
			
					If you want to use Redis with sentinels, you must create the system-redis secret with all fields in order to configure the Redis you want to point to before deploying 3scale. The fields are not provided as parameters in the back end as of 3scale.
				
8.2.1. Creating backend-redis and system-redis secrets
					Follow these steps to create backend-redis and system-redis secrets accordingly:
				
8.2.2. Deploying a fresh installation of 3scale for HA
- Create the - backend-redisand- system-redissecrets with the fields below:- backend-redis - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - system-redis - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - When configuring for Redis with sentinels, the corresponding - URLfields in- backend-redisand- system-redisrefer to the Redis group in the format- redis://[:redis-password@]redis-group[/db]`, where [x] denotes optional element x and- redis-password,- redis-group, and- dbare 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_HOSTSfields 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, and- portare 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_ROLEfields are eithermasterorslave.
 
- Deploy 3scale as indicated in Deploying 3scale on OpenShift using a template, using the latest version of the templates. - 
									Ignore the errors due to backend-redisandsystem-redisalready present.
 
- 
									Ignore the errors due to 
8.2.3. Migrating a non-HA deployment of 3scale to HA
- 
							Edit the backend-redisandsystem-redissecrets with all fields as shown in Deploying a fresh installation of 3scale for HA.
- Make sure the following - backend-redisenvironment variables are defined for the back-end pods.- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Make sure the following - system-redisenvironment variables are defined for the- system-(app|sidekiq|sphinx)pods.- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Proceed with instructions to continue upgrading 3scale 2.6 to 2.7 using templates. - Follow the steps in this order: 
 
8.2.3.1. Using Redis Enterprise
- Use Redis Enterprise deployed in OpenShift, with three different - redis-enterpriseinstances:- Edit - system-redissecret:- 
												Set distinct values to MESSAGE_BUS_NAMESPACEandNAMESPACE.
- 
												Set URLandMESSAGE_BUS_URLto the same database.
 
- 
												Set distinct values to 
- 
										Set the back-end database in backend-redistoREDIS_QUEUES_URL.
- 
										Set the third database to REDIS_STORAGE_URLforbackend-redis.
 
8.2.3.2. Using Redis Sentinel
- Use Redis Sentinel, with three or four different Redis databases: - Edit - system-redissecret:- 
												Set distinct values to MESSAGE_BUS_NAMESPACEandNAMESPACE.
- 
												Set URLandMESSAGE_BUS_URLto the proper Redis group, for example:redis://:redispwd@mymaster/5
- 
												Set SENTINEL_HOSTSandMESSAGE_BUS_SENTINEL_HOSTSto a comma-separated list of sentinels hosts and ports, for example::sentinelpwd@123.45.67.009:2711,:sentinelpwd@other-sentinel:2722
- 
												Set SENTINEL_ROLEandMESSAGE_BUS_SENTINEL_ROLEto master
 
- 
												Set distinct values to 
 
- Set the - backend-redissecret for back-end with the values:- 
										REDIS_QUEUES_URL
- 
										REDIS_QUEUES_SENTINEL_ROLE
- 
										REDIS_QUEUES_SENTINEL_HOSTS
 
- 
										
- Set the variables in the third database as follows: - 
										REDIS_STORAGE_URL
- 
										REDIS_STORAGE_SENTINEL_ROLE
- 
										REDIS_STORAGE_SENTINEL_HOSTS
 
- 
										
Notes
- The system-app and system-sidekiq components connect directly to - back-endRedis for retrieving statistics.- 
										As of 3scale 2.7, these system components can also connect to back-endRedis (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-redisstorage, not- backend-redisqueues.- 
										Changes made to the system components support backend-redisstorage with sentinels.
 
- 
										Changes made to the system components support 
8.3. Additional information
- For more information about 3scale and Redis database support, see Red Hat 3scale API Management Supported Configurations.