---
title: "Redis"
canonical_url: "https://www.zone.lv/help/kb/redis-en/"
post_type: "ht_kb"
published: "2023-06-13T12:16:43+00:00"
modified: "2024-05-16T09:25:02+00:00"
language: "en"
author: "martti"
taxonomies:
  ht_kb_category:
    - name: "Technical"
      url: "https://www.zone.lv/help/kb-categories/technical-en/"
    - name: "Wordpress"
      url: "https://www.zone.lv/help/kb-categories/wordpress-en/"
  ht_kb_tag:
    - name: "redis"
      url: "https://www.zone.lv/help/kb-tags/redis-en/"
    - name: "wordpress"
      url: "https://www.zone.lv/help/kb-tags/wordpress-en/"
---

# Redis

## redis-cli

To use redis-cli, next command must be used:
`> vs-redis-cli`

Information about the version of Redis, connected clients/applications, and other details can be seen using next redis-cli command:
`> info`

A full list of redis-cli commands and information about their usage can be found in the Redis documentation:
[redis.io/commands/](https://redis.io/commands/)

## Using Redis Object Cache For WordPress

For the WordPress plugin Redis Object Cache, the minimum required PHP version is 7.2. Additionally for the corresponding main or subdomain where WordPress is installed, the Redis extension under PHP extensions must be enabled, which is on by default.

 Attention! It is recommended first to make [a snapshot](https://www.zone.lv/help/en/kb/zone-application-manager/#h2snapshots-and-restoring-from-themh2) of the website to have a safe restore point in case something goes wrong.

### Starting the Redis Server

To start the Redis server, go to the Webhosting page in My Zone management, select from the menu: `Databases` &gt; `Redis` and click on the `Enable Redis instance` button:

![](https://www.zone.lv/static/sites/5/start_redis_en.png)

 The Redis server will be started for the virtual server within 2 minutes.

Keep this page open until the necessary information for the WordPress’ wp-config.php file has been copied from here.

 Attention! If there is no Redis option under the Databases menu, then the web hosting service package must be upgraded.

### Configuration and Activation

Log into the WordPress dashboard and install and activate the new plugin called Redis Object Cache.

Next, open the WordPress configuration file `wp-config.php`.

 Files in the web server can be edited via FTP or SSH Instructions for establishing FTP and SSH connections:
[FTP – Logging in](https://www.zone.lv/help/en/kb/login-to-ftp/)
[Establishing a SSH Connection](https://www.zone.lv/help/kb/ssh-uhenduse-loomine/)

Add the necessary Redis configuration data to the `wp-config.php` file before the “stop editing” line located at the end of the file.

```
define( 'WP_REDIS_HOST', '127.1.23.456' );
define( 'WP_REDIS_PORT', 6379 );
define( 'WP_REDIS_PASSWORD', 'abcdefghijklm1234567890' );
define( 'WP_REDIS_CLIENT', 'predis' );
define( 'WP_REDIS_PREFIX', 'my-site' );
define( 'WP_REDIS_DATABASE', 0 );
define( 'WP_REDIS_TIMEOUT', 1 );
define( 'WP_REDIS_READ_TIMEOUT', 1 );
```

Values for `WP_REDIS_HOST` ja `WP_REDIS_PASSWORD` can be found on Webhosting page in My Zone management, under `Databases` &gt; `Redis`.

Remaining configuration details and detailed instructions can be found in the plugin documentation:
[Redis Object Cache for WordPress – Configuration](https://github.com/rhubarbgroup/redis-cache/#configuration)
[Installing Redis Object Cache – Configuring the plugin](https://github.com/rhubarbgroup/redis-cache/blob/develop/INSTALL.md#3-configuring-the-plugin)

After adding the Redis configuration into the `wp-config.php` file, reload the Redis page in the WordPress dashboard: `Settings` &gt; `Redis`. On the `Overview` tab, Redis should now be as “Reachable”:

![](https://www.zone.lv/static/sites/5/settings_redis_en.png)Then activate Redis by clicking the `Enable Object Cache` button on the same page.

 Useful tip Redis status can also be viewed and activated via SSH using WP-CLI commands:
&gt; wp redis status
&gt; wp redis enable

There are additional WP-CLI commands for Redis Object Cache.
To get more information, use the next command after installing the plugin:
&gt; wp help redis

### Usage Graphs

The usage graphs of Redis, which provide an overview of memory usage, operations, connections, and key usage, can be viewed in My Zone management, on Webhosting page, under `Databases` &gt; `Redis`.

### Flushing Redis cache

In most cases there is no need to flush the Redis cache.
However, it can be done as a last resort if WordPress background operations or the dashboard are not functioning properly or if enabling and disabling plugins will fail.
To flush the Redis cache, go to the `Settings` &gt; `Redis` in the WordPress dashboard and click the Flush Cache button.
The redis-cli command for this is:
`> FLUSHALL `

### WordPress error “Error establishing a Redis connection”

If WordPress displays an error message “Error establishing a Redis connection”, it means either that the Redis server is not running or the WordPress configuration file wp-config.php is missing the Redis configuration or it is incorrect.

![](https://www.zone.lv/static/sites/5/error_establishing_a_redis_connection_en.png)
