From 6396a807b48117b79ba5f23946a71158fd951aea Mon Sep 17 00:00:00 2001 From: Eoghan Rainey Date: Tue, 16 Sep 2025 14:13:46 +0200 Subject: [PATCH 01/10] add valkey docs --- ...ze-the-performance-of-your-magento-shop.md | 4 +- .../how-to-configure-redis-for-magento-1.md | 3 +- .../how-to-configure-redis-for-magento-2.md | 3 + .../how-to-configure-valkey-for-magento-2.md | 177 ++++++++++++++++++ documentation_urls.txt | 1 + 5 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md diff --git a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md index c6c16980..eb1787fb 100644 --- a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md +++ b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md @@ -125,7 +125,9 @@ On bigger Hypernodes with more memory available, you can reduce disk IO by stori This only works on bigger nodes, as there needs to be some memory available for rendering pages using PHP too. -To store sessions in Redis, take a look at [the instructions on how to configure this](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md) ([Magento 2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md)) +To store sessions in Redis, take a look at [the instructions on how to configure this on Magento-1](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md) ([Redis on Magento 2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) ) +([Valkey on Magento 2](../../ecommerce-applications/magento2/how-to-configure-valkey-on-magento-2.md)) + ## Image Optimizations (10 mins) diff --git a/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md b/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md index 466be758..f579c7d2 100644 --- a/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md +++ b/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md @@ -18,7 +18,8 @@ Redis is a caching method which can increase the speed of the backend and fronte **NB: When you used the [hypernode-importer](../../hypernode-platform/tools/how-to-migrate-your-shop-to-hypernode.md#how-to-migrate-your-shop-to-hypernode) and you were already using Redis you don't have to follow this tutorial.** -Want to know how to configure Redis in Magento 2? Have a look at [this article](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md)! +Want to know how to configure Redis or Valkey in Magento 2? Have a look at [Redis on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) or +[Valkey on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)! ## Setup Redis by Changing your local.xml File diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index 7ec896e3..96ceae82 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -19,6 +19,9 @@ Redis is a caching method which can increase the speed of the backend and fronte Want to know how to configure Redis in Magento 1? Have a look at [this article](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md)! +Want to know how to configure Valkey in Magento 2? Have a look at [this article](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)! + + ## Configure Redis Cache for Magento 2 There are two ways to configure Redis Cache for Magento 2. You can either run a command which automatically updates the `env.php` with the correct details or you can manually change the `env.php` file. diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md new file mode 100644 index 00000000..0132163f --- /dev/null +++ b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md @@ -0,0 +1,177 @@ +--- +myst: + html_meta: + description: This article explains how to configure Valkey on your Magento 2 shop on Hypernode and how to work with redis-cli or valkey-cli. + title: How to configure Valkey for Magento 2? | Hypernode +redirect_from: + - /ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2/ +--- + +# How to Enable Valkey for Magento 2 + +Valkey is a Redis-compatible in-memory store. On Hypernode, **Valkey-8** is available on Debian Bookworm single-node setups. It is not supported on Debian Buster or on Hypernode Clusters. **Redis remains supported.** + +> If you previously used Redis, **no action needed** after enabling it ( **see example below** ), existing Magento settings continue to work with Valkey. +> +## Paths + +- Logs: `/var/log/valkey/` +- App-scoped directory on Hypernode: `/data/web/valkey/` + +--- + +Valkey is Redis-compatible, so your existing Magento `redis` configuration flags work unchanged. + +> **Enable Valkey on supported nodes** +> +> ```console +> $ hypernode-systemctl settings valkey_enabled True +> ``` + +Take a look at the `livelog` command to check the progress on the update job. + +## Redis Tools or Valkey Tools? + +> `redis-cli`and `redis-tools` is symlinked to `valkey-cli` and `valkey-tools` when Valkey is enabled. You can use **either**. Examples below show `redis-cli` with an `or valkey-cli` alternative. + + +# First Time Setup - Redis Not Previously Configured + +## Configure Valkey Cache for Magento 2 + +There are two ways to configure the cache. You can run a command that updates `env.php`, or you can edit it yourself. + +## Configure Valkey Cache for Magento 2 Through the Commandline + +Use the following command to enable backend caching: + +```console +$ cd /data/web/magento2 +$ bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redismaster --cache-backend-redis-db=1 +``` + +Now flush your cache: + +```console +$ rm -rf /data/web/magento2/var/cache/* +$ redis-cli flushall +# or +$ valkey-cli flushall +``` + +## Configure Valkey Full Page Caching for Magento 2 + +Enable page caching: + +```console +$ cd /data/web/magento2 +$ bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redismaster --page-cache-redis-db=2 +``` + +And flush your cache: + +```console +$ rm -rf /data/web/magento2/var/cache/* +$ redis-cli flushall +# or +$ valkey-cli flushall +``` + +## Flush Your Caches + +To flush your Magento cache, clear the Valkey database you configured: + +```console +$ redis-cli -n 1 flushdb +# or +$ valkey-cli -n 1 flushdb +``` + +Or alternatively use `n98-magerun2` or the Magento cli tool: + +```console +## Flush using n98-magerun2 +$ n98-magerun2 cache:flush +## Flush using magento cli +$ cd /data/web/magento2 && bin/magento cache:flush +``` + +To flush all sessions, caches etc (flush the full instance), use the following command: + +```console +$ redis-cli flushall +# or +$ valkey-cli flushall +``` + +## Changing the Compression Library + +It is possible to use the compression library 'Snappy' on Hypernode. + +In order to use the compression library Snappy for your Valkey cache you can run the following commands: + +```console +$ bin/magento setup:config:set --cache-backend-redis-compression-lib=snappy +$ # If you use Magento's builtin page cache +$ bin/magento setup:config:set --page-cache-redis-compression-lib=snappy +``` + +## Configure Magento 2 to Use Valkey as the Session Store + +You can use Valkey for storing sessions too. + +### Configure Magento 2 to Store Sessions in Valkey + +Run the following command: + +```console +$ cd /data/web/magento2 +$ bin/magento setup:config:set --session-save=redis --session-save-redis-host=redismaster --session-save-redis-db=3 +``` + +Now flush your cache: + +```console +$ redis-cli flushall +# or +$ valkey-cli flushall +``` + +### Enable Second Valkey Instance for Sessions + +Enable the second instance for sessions: + +```console +$ hypernode-systemctl settings redis_persistent_instance True +``` + +After enabling the second instance change the session port to `6378` and the database to `0`: + +```console +$ cd /data/web/magento2 +$ bin/magento setup:config:set --session-save-redis-port=6378 --session-save-redis-db=0 +``` + +Furthermore you can add the following line to your crontab to take periodic background snapshots: + +``` +* * * * * redis-cli -p 6378 bgsave +# or +* * * * * valkey-cli -p 6378 bgsave +``` + +### Test Whether Your Sessions Are Stored in Valkey + +To verify whether your configuration is working properly, first clear your filesystem session store: + +```console +$ rm /data/web/public/var/sessions/* +``` + +Now open the site in your browser and hit `F5` a few times or log in to the admin panel. Then check the configured database: + +```console +$ redis-cli -n 0 keys '*' +# or +$ valkey-cli -n 0 keys '*' +``` diff --git a/documentation_urls.txt b/documentation_urls.txt index 29b9d1ee..3436aa32 100644 --- a/documentation_urls.txt +++ b/documentation_urls.txt @@ -86,6 +86,7 @@ article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-the-ret article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-up-a-staging-environment-for-magento-1/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-change-your-magento-2-base-urls/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-redis-for-magento-2/ +article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-valkey-for-magento-2/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-varnish-for-magento-2-x/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-robots-txt-for-magento-2-x/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-sitemap-xml-for-magento-2-x/ From 395dc0da807e59d626736f879e59d8761aa312e6 Mon Sep 17 00:00:00 2001 From: Eoghan Rainey Date: Tue, 16 Sep 2025 14:21:30 +0200 Subject: [PATCH 02/10] precommit --- .../magento-2/how-to-configure-valkey-for-magento-2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md index 0132163f..2145c082 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md @@ -28,7 +28,7 @@ Valkey is Redis-compatible, so your existing Magento `redis` configuration flags > $ hypernode-systemctl settings valkey_enabled True > ``` -Take a look at the `livelog` command to check the progress on the update job. +Take a look at the `livelog` command to check the progress on the update job. ## Redis Tools or Valkey Tools? @@ -37,7 +37,7 @@ Take a look at the `livelog` command to check the progress on the update job. # First Time Setup - Redis Not Previously Configured -## Configure Valkey Cache for Magento 2 +## Configure Valkey Cache for Magento 2 There are two ways to configure the cache. You can run a command that updates `env.php`, or you can edit it yourself. From 2ae2c3b5d76f1c7de12a1e65dd1f641ee59c76e9 Mon Sep 17 00:00:00 2001 From: Eoghan Rainey Date: Tue, 16 Sep 2025 14:22:01 +0200 Subject: [PATCH 03/10] Update docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md remove whitespace Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../how-to-optimize-the-performance-of-your-magento-shop.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md index eb1787fb..e463478d 100644 --- a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md +++ b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md @@ -128,7 +128,6 @@ This only works on bigger nodes, as there needs to be some memory available for To store sessions in Redis, take a look at [the instructions on how to configure this on Magento-1](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md) ([Redis on Magento 2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) ) ([Valkey on Magento 2](../../ecommerce-applications/magento2/how-to-configure-valkey-on-magento-2.md)) - ## Image Optimizations (10 mins) Big images take more time to download and view than smaller images. We created a resize tool to reduce the size of your images to improve load times. To do this, use the Hypernode-image-optimizer which is installed on all nodes. It’s recommended to run this command nightly through cron. More information can be found in [this article about optimizing your image size](../../best-practices/performance/how-to-optimize-your-images.md). From 8395b8d891f4c9fa22ec96e2e34d0b7cc9792ab5 Mon Sep 17 00:00:00 2001 From: Eoghan Rainey Date: Tue, 16 Sep 2025 14:22:44 +0200 Subject: [PATCH 04/10] Update docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../magento-2/how-to-configure-redis-for-magento-2.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index 96ceae82..cb4aa8e5 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -21,7 +21,6 @@ Want to know how to configure Redis in Magento 1? Have a look at [this article]( Want to know how to configure Valkey in Magento 2? Have a look at [this article](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)! - ## Configure Redis Cache for Magento 2 There are two ways to configure Redis Cache for Magento 2. You can either run a command which automatically updates the `env.php` with the correct details or you can manually change the `env.php` file. From 5547102fd6a331231ce1ab23e37034eb71260019 Mon Sep 17 00:00:00 2001 From: Martijn Eichelsheim Date: Mon, 6 Oct 2025 13:42:09 +0200 Subject: [PATCH 05/10] Update documentation --- .../magento-2/how-to-configure-valkey-for-magento-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md index 2145c082..7d19ab02 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md @@ -9,7 +9,7 @@ redirect_from: # How to Enable Valkey for Magento 2 -Valkey is a Redis-compatible in-memory store. On Hypernode, **Valkey-8** is available on Debian Bookworm single-node setups. It is not supported on Debian Buster or on Hypernode Clusters. **Redis remains supported.** +Valkey is a Redis-compatible in-memory store. **Valkey-8** is available on Debian Bookworm Hypernodes. > If you previously used Redis, **no action needed** after enabling it ( **see example below** ), existing Magento settings continue to work with Valkey. > From 68319ee87c37baa5e06cfa4ff34c88806d980910 Mon Sep 17 00:00:00 2001 From: Martijn Eichelsheim Date: Mon, 6 Oct 2025 14:08:50 +0200 Subject: [PATCH 06/10] Remove duplicate valkey <> redis documentation --- .../how-to-configure-redis-for-magento-1.md | 3 +- .../how-to-configure-redis-for-magento-2.md | 47 +++-- .../how-to-configure-valkey-for-magento-2.md | 177 ------------------ 3 files changed, 30 insertions(+), 197 deletions(-) delete mode 100644 docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md diff --git a/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md b/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md index f579c7d2..51ee6e36 100644 --- a/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md +++ b/docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md @@ -18,8 +18,7 @@ Redis is a caching method which can increase the speed of the backend and fronte **NB: When you used the [hypernode-importer](../../hypernode-platform/tools/how-to-migrate-your-shop-to-hypernode.md#how-to-migrate-your-shop-to-hypernode) and you were already using Redis you don't have to follow this tutorial.** -Want to know how to configure Redis or Valkey in Magento 2? Have a look at [Redis on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) or -[Valkey on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)! +Want to know how to configure Redis or Valkey in Magento 2? Have a look at [Redis on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md)! ## Setup Redis by Changing your local.xml File diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index cb4aa8e5..aad099e7 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -13,21 +13,32 @@ redirect_from: -# How to Configure Redis for Magento 2 + +# How to Configure Redis / Valkey for Magento 2 Redis is a caching method which can increase the speed of the backend and frontend of your shop. On Hypernode every customer has access to Redis cache, starting from 64 MB, depending on the plan. This article will explain how to configure Redis on your Magento 2 shop on Hypernode and how to work with redis-cli. +Valkey is a Redis-compatible in-memory store en supported by the latest Magento 2 versions. Since all the existing Redis configuration flags work unchanged, you can easily switch from Redis to Valkey. Valkey is available on Debian Bookworm Hypernodes. +> `redis-cli`and `redis-tools` is symlinked to `valkey-cli` and `valkey-tools` when Valkey is enabled. You can use **either**. Examples below show `redis-cli` with an `or valkey-cli` alternative. Want to know how to configure Redis in Magento 1? Have a look at [this article](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md)! -Want to know how to configure Valkey in Magento 2? Have a look at [this article](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)! +# Enable Redis or Valkey on your Hypernode + +First thing you need to do is enable Redis or Valkey on your Hypernode. + +Redis is enabled by default, if you want to make use of Valkey, you can enable it by running the following command: + +```console +$ hypernode-systemctl settings valkey_enabled true +``` -## Configure Redis Cache for Magento 2 +## Configure Redis/Valkey Cache for Magento 2 -There are two ways to configure Redis Cache for Magento 2. You can either run a command which automatically updates the `env.php` with the correct details or you can manually change the `env.php` file. +There are two ways to configure Redis/Valkey Cache for Magento 2. You can either run a command which automatically updates the `env.php` with the correct details or you can manually change the `env.php` file. -## Configure Redis Cache for Magento 2 Through the Commandline +## Configure Redis/Valkey Cache for Magento 2 Through the Commandline -Use the following command to enable Redis backend caching: +Use the following command to enable Redis/Valkey backend caching: ```console $ cd /data/web/magento2 @@ -44,9 +55,9 @@ $ rm -rf /data/web/magento2/var/cache/* $ redis-cli flushall ``` -## Configure Redis Full Page Caching for Magento 2 +## Configure Redis/Valkey Full Page Caching for Magento 2 -To enable page caching Redis, extend your /data/web/magento2/app/etc/env.php with the following snippet. You should paste this in between the cache keys, so leave the cache tag in this snippet out of it. +To enable page caching in Redis/Valkey, extend your /data/web/magento2/app/etc/env.php with the following snippet. You should paste this in between the cache keys, so leave the cache tag in this snippet out of it. ```console $ cd /data/web/magento2 @@ -65,7 +76,7 @@ $ redis-cli flushall ## Flush Your Caches -To flush your Magento cache, clear the Redis database corresponding to your configured Redis database: +To flush your Magento cache, clear the Redis/Valkey database corresponding to your configured Redis/Valkey database: ```console $ redis-cli -n 1 flushdb @@ -98,15 +109,15 @@ $ # If you use Magento's builtin page cache with Redis $ bin/magento setup:config:set --page-cache-redis-compression-lib=snappy ``` -## Configure Magento 2 to Use Redis as the Session Store +## Configure Magento 2 to Use Redis/Valkey as the Session Store -You can use Redis for storing sessions too! +You can use Redis/Valkey for storing sessions too! -Hypernodes bigger than a Grow plan, often have enough memory to store the session data in Redis. This way sessions are stored in-memory, making the shop faster and use less IO than when using MySQL or files as session store. +Hypernodes bigger than a Grow plan, often have enough memory to store the session data in Redis/Valkey. This way sessions are stored in-memory, making the shop faster and use less IO than when using MySQL or files as session store. -### Configure Magento 2 to Store Sessions in Redis +### Configure Magento 2 to Store Sessions in Redis/Valkey -As Magento 2 is fully supporting Redis, there is no need to install additional extensions to configure Redis. All you need to do is extend your `app/etc/env.php` and flush your cache. +As Magento 2 is fully supporting Redis, there is no need to install additional extensions to configure Redis/Valkey. All you need to do is extend your `app/etc/env.php` and flush your cache. To enable session storage in Redis, run the following command: @@ -125,13 +136,13 @@ $ rm -rf /data/web/magento2/var/cache/* $ redis-cli flushall ``` -### Enable Second Redis Instance for Sessions +### Enable Second Redis/Valkey Instance for Sessions We have made it possible to enable a second Redis instance more tailored for saving session data (more information can be found in our [changelog](https://changelog.hypernode.com/changelog/experimental-changes-redis-sessions-aws-performance/)). -To enable the second Redis instance for sessions you run the command: `hypernode-systemctl settings redis_persistent_instance True` +To enable the second Redis/Valkey instance for sessions you run the command: `hypernode-systemctl settings redis_persistent_instance True` -After enabling the second Redis instance you need to change the configured Redis session port value to `6378` instead of the default `6379` and the database to `0`, since we're using a separate Redis instance now: +After enabling the second Redis/Valkey instance you need to change the configured Redis session port value to `6378` instead of the default `6379` and the database to `0`, since we're using a separate Redis/Valkey instance now: ```console $ cd /data/web/magento2 @@ -146,7 +157,7 @@ Furthermore you need to add the following line to your crontab: * * * * * redis-cli -p 6378 bgsave ``` -### Test Whether Your Sessions Are Stored in Redis +### Test Whether Your Sessions Are Stored in Redis/Valkey To verify whether your configuration is working properly, first clear your session store: diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md deleted file mode 100644 index 7d19ab02..00000000 --- a/docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md +++ /dev/null @@ -1,177 +0,0 @@ ---- -myst: - html_meta: - description: This article explains how to configure Valkey on your Magento 2 shop on Hypernode and how to work with redis-cli or valkey-cli. - title: How to configure Valkey for Magento 2? | Hypernode -redirect_from: - - /ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2/ ---- - -# How to Enable Valkey for Magento 2 - -Valkey is a Redis-compatible in-memory store. **Valkey-8** is available on Debian Bookworm Hypernodes. - -> If you previously used Redis, **no action needed** after enabling it ( **see example below** ), existing Magento settings continue to work with Valkey. -> -## Paths - -- Logs: `/var/log/valkey/` -- App-scoped directory on Hypernode: `/data/web/valkey/` - ---- - -Valkey is Redis-compatible, so your existing Magento `redis` configuration flags work unchanged. - -> **Enable Valkey on supported nodes** -> -> ```console -> $ hypernode-systemctl settings valkey_enabled True -> ``` - -Take a look at the `livelog` command to check the progress on the update job. - -## Redis Tools or Valkey Tools? - -> `redis-cli`and `redis-tools` is symlinked to `valkey-cli` and `valkey-tools` when Valkey is enabled. You can use **either**. Examples below show `redis-cli` with an `or valkey-cli` alternative. - - -# First Time Setup - Redis Not Previously Configured - -## Configure Valkey Cache for Magento 2 - -There are two ways to configure the cache. You can run a command that updates `env.php`, or you can edit it yourself. - -## Configure Valkey Cache for Magento 2 Through the Commandline - -Use the following command to enable backend caching: - -```console -$ cd /data/web/magento2 -$ bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redismaster --cache-backend-redis-db=1 -``` - -Now flush your cache: - -```console -$ rm -rf /data/web/magento2/var/cache/* -$ redis-cli flushall -# or -$ valkey-cli flushall -``` - -## Configure Valkey Full Page Caching for Magento 2 - -Enable page caching: - -```console -$ cd /data/web/magento2 -$ bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redismaster --page-cache-redis-db=2 -``` - -And flush your cache: - -```console -$ rm -rf /data/web/magento2/var/cache/* -$ redis-cli flushall -# or -$ valkey-cli flushall -``` - -## Flush Your Caches - -To flush your Magento cache, clear the Valkey database you configured: - -```console -$ redis-cli -n 1 flushdb -# or -$ valkey-cli -n 1 flushdb -``` - -Or alternatively use `n98-magerun2` or the Magento cli tool: - -```console -## Flush using n98-magerun2 -$ n98-magerun2 cache:flush -## Flush using magento cli -$ cd /data/web/magento2 && bin/magento cache:flush -``` - -To flush all sessions, caches etc (flush the full instance), use the following command: - -```console -$ redis-cli flushall -# or -$ valkey-cli flushall -``` - -## Changing the Compression Library - -It is possible to use the compression library 'Snappy' on Hypernode. - -In order to use the compression library Snappy for your Valkey cache you can run the following commands: - -```console -$ bin/magento setup:config:set --cache-backend-redis-compression-lib=snappy -$ # If you use Magento's builtin page cache -$ bin/magento setup:config:set --page-cache-redis-compression-lib=snappy -``` - -## Configure Magento 2 to Use Valkey as the Session Store - -You can use Valkey for storing sessions too. - -### Configure Magento 2 to Store Sessions in Valkey - -Run the following command: - -```console -$ cd /data/web/magento2 -$ bin/magento setup:config:set --session-save=redis --session-save-redis-host=redismaster --session-save-redis-db=3 -``` - -Now flush your cache: - -```console -$ redis-cli flushall -# or -$ valkey-cli flushall -``` - -### Enable Second Valkey Instance for Sessions - -Enable the second instance for sessions: - -```console -$ hypernode-systemctl settings redis_persistent_instance True -``` - -After enabling the second instance change the session port to `6378` and the database to `0`: - -```console -$ cd /data/web/magento2 -$ bin/magento setup:config:set --session-save-redis-port=6378 --session-save-redis-db=0 -``` - -Furthermore you can add the following line to your crontab to take periodic background snapshots: - -``` -* * * * * redis-cli -p 6378 bgsave -# or -* * * * * valkey-cli -p 6378 bgsave -``` - -### Test Whether Your Sessions Are Stored in Valkey - -To verify whether your configuration is working properly, first clear your filesystem session store: - -```console -$ rm /data/web/public/var/sessions/* -``` - -Now open the site in your browser and hit `F5` a few times or log in to the admin panel. Then check the configured database: - -```console -$ redis-cli -n 0 keys '*' -# or -$ valkey-cli -n 0 keys '*' -``` From 207a6c4ec1ece173e2f50e35c9b5f040babb2b37 Mon Sep 17 00:00:00 2001 From: Martijn Eichelsheim Date: Mon, 6 Oct 2025 14:11:31 +0200 Subject: [PATCH 07/10] Remove valkey docs uri and redirect links --- .../how-to-optimize-the-performance-of-your-magento-shop.md | 3 +-- documentation_urls.txt | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md index e463478d..5bc20edc 100644 --- a/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md +++ b/docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md @@ -125,8 +125,7 @@ On bigger Hypernodes with more memory available, you can reduce disk IO by stori This only works on bigger nodes, as there needs to be some memory available for rendering pages using PHP too. -To store sessions in Redis, take a look at [the instructions on how to configure this on Magento-1](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md) ([Redis on Magento 2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) ) -([Valkey on Magento 2](../../ecommerce-applications/magento2/how-to-configure-valkey-on-magento-2.md)) +To store sessions in Redis, take a look at [the instructions on how to configure this on Magento 1](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md) ([Redis on Magento 2](../../ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md) ) ## Image Optimizations (10 mins) diff --git a/documentation_urls.txt b/documentation_urls.txt index 413a9f9e..d08418e8 100644 --- a/documentation_urls.txt +++ b/documentation_urls.txt @@ -85,7 +85,6 @@ article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-the-ret article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-up-a-staging-environment-for-magento-1/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-change-your-magento-2-base-urls/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-redis-for-magento-2/ -article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-valkey-for-magento-2/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-varnish-for-magento-2-x/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-robots-txt-for-magento-2-x/ article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-sitemap-xml-for-magento-2-x/ From 5e12a4765c5f895ce687b764b6b1b52a1c688286 Mon Sep 17 00:00:00 2001 From: martijneichelsheim Date: Mon, 6 Oct 2025 14:18:58 +0200 Subject: [PATCH 08/10] Update docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../magento-2/how-to-configure-redis-for-magento-2.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index aad099e7..dfb06dd6 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -13,7 +13,6 @@ redirect_from: - # How to Configure Redis / Valkey for Magento 2 Redis is a caching method which can increase the speed of the backend and frontend of your shop. On Hypernode every customer has access to Redis cache, starting from 64 MB, depending on the plan. This article will explain how to configure Redis on your Magento 2 shop on Hypernode and how to work with redis-cli. From a95111b1c2ad2cd4c55318b9b17e7130e302d997 Mon Sep 17 00:00:00 2001 From: martijneichelsheim Date: Mon, 6 Oct 2025 14:19:10 +0200 Subject: [PATCH 09/10] Update docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../magento-2/how-to-configure-redis-for-magento-2.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index dfb06dd6..c70e6fa1 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -16,7 +16,8 @@ redirect_from: # How to Configure Redis / Valkey for Magento 2 Redis is a caching method which can increase the speed of the backend and frontend of your shop. On Hypernode every customer has access to Redis cache, starting from 64 MB, depending on the plan. This article will explain how to configure Redis on your Magento 2 shop on Hypernode and how to work with redis-cli. -Valkey is a Redis-compatible in-memory store en supported by the latest Magento 2 versions. Since all the existing Redis configuration flags work unchanged, you can easily switch from Redis to Valkey. Valkey is available on Debian Bookworm Hypernodes. +Valkey is a Redis-compatible in-memory store en supported by the latest Magento 2 versions. Since all the existing Redis configuration flags work unchanged, you can easily switch from Redis to Valkey. Valkey is available on Debian Bookworm Hypernodes. + > `redis-cli`and `redis-tools` is symlinked to `valkey-cli` and `valkey-tools` when Valkey is enabled. You can use **either**. Examples below show `redis-cli` with an `or valkey-cli` alternative. Want to know how to configure Redis in Magento 1? Have a look at [this article](../../ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md)! From 61000bb528cb2fd745bf239571311b95bb286991 Mon Sep 17 00:00:00 2001 From: martijneichelsheim Date: Mon, 6 Oct 2025 14:19:18 +0200 Subject: [PATCH 10/10] Update docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../magento-2/how-to-configure-redis-for-magento-2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md index c70e6fa1..9915cd6c 100644 --- a/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md +++ b/docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md @@ -24,7 +24,7 @@ Want to know how to configure Redis in Magento 1? Have a look at [this article]( # Enable Redis or Valkey on your Hypernode -First thing you need to do is enable Redis or Valkey on your Hypernode. +First thing you need to do is enable Redis or Valkey on your Hypernode. Redis is enabled by default, if you want to make use of Valkey, you can enable it by running the following command: