Skip to content

Commit 6396a80

Browse files
add valkey docs
1 parent 9739252 commit 6396a80

5 files changed

Lines changed: 186 additions & 2 deletions

File tree

docs/best-practices/performance/how-to-optimize-the-performance-of-your-magento-shop.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ On bigger Hypernodes with more memory available, you can reduce disk IO by stori
125125

126126
This only works on bigger nodes, as there needs to be some memory available for rendering pages using PHP too.
127127

128-
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))
128+
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) )
129+
([Valkey on Magento 2](../../ecommerce-applications/magento2/how-to-configure-valkey-on-magento-2.md))
130+
129131

130132
## Image Optimizations (10 mins)
131133

docs/ecommerce-applications/magento-1/how-to-configure-redis-for-magento-1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ Redis is a caching method which can increase the speed of the backend and fronte
1818

1919
**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.**
2020

21-
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)!
21+
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
22+
[Valkey on Magento-2](../../ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md)!
2223

2324
## Setup Redis by Changing your local.xml File
2425

docs/ecommerce-applications/magento-2/how-to-configure-redis-for-magento-2.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Redis is a caching method which can increase the speed of the backend and fronte
1919

2020
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)!
2121

22+
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)!
23+
24+
2225
## Configure Redis Cache for Magento 2
2326

2427
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.
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
---
2+
myst:
3+
html_meta:
4+
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.
5+
title: How to configure Valkey for Magento 2? | Hypernode
6+
redirect_from:
7+
- /ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2/
8+
---
9+
10+
# How to Enable Valkey for Magento 2
11+
12+
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.**
13+
14+
> If you previously used Redis, **no action needed** after enabling it ( **see example below** ), existing Magento settings continue to work with Valkey.
15+
>
16+
## Paths
17+
18+
- Logs: `/var/log/valkey/`
19+
- App-scoped directory on Hypernode: `/data/web/valkey/`
20+
21+
---
22+
23+
Valkey is Redis-compatible, so your existing Magento `redis` configuration flags work unchanged.
24+
25+
> **Enable Valkey on supported nodes**
26+
>
27+
> ```console
28+
> $ hypernode-systemctl settings valkey_enabled True
29+
> ```
30+
31+
Take a look at the `livelog` command to check the progress on the update job.
32+
33+
## Redis Tools or Valkey Tools?
34+
35+
> `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.
36+
37+
38+
# First Time Setup - Redis Not Previously Configured
39+
40+
## Configure Valkey Cache for Magento 2
41+
42+
There are two ways to configure the cache. You can run a command that updates `env.php`, or you can edit it yourself.
43+
44+
## Configure Valkey Cache for Magento 2 Through the Commandline
45+
46+
Use the following command to enable backend caching:
47+
48+
```console
49+
$ cd /data/web/magento2
50+
$ bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redismaster --cache-backend-redis-db=1
51+
```
52+
53+
Now flush your cache:
54+
55+
```console
56+
$ rm -rf /data/web/magento2/var/cache/*
57+
$ redis-cli flushall
58+
# or
59+
$ valkey-cli flushall
60+
```
61+
62+
## Configure Valkey Full Page Caching for Magento 2
63+
64+
Enable page caching:
65+
66+
```console
67+
$ cd /data/web/magento2
68+
$ bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=redismaster --page-cache-redis-db=2
69+
```
70+
71+
And flush your cache:
72+
73+
```console
74+
$ rm -rf /data/web/magento2/var/cache/*
75+
$ redis-cli flushall
76+
# or
77+
$ valkey-cli flushall
78+
```
79+
80+
## Flush Your Caches
81+
82+
To flush your Magento cache, clear the Valkey database you configured:
83+
84+
```console
85+
$ redis-cli -n 1 flushdb
86+
# or
87+
$ valkey-cli -n 1 flushdb
88+
```
89+
90+
Or alternatively use `n98-magerun2` or the Magento cli tool:
91+
92+
```console
93+
## Flush using n98-magerun2
94+
$ n98-magerun2 cache:flush
95+
## Flush using magento cli
96+
$ cd /data/web/magento2 && bin/magento cache:flush
97+
```
98+
99+
To flush all sessions, caches etc (flush the full instance), use the following command:
100+
101+
```console
102+
$ redis-cli flushall
103+
# or
104+
$ valkey-cli flushall
105+
```
106+
107+
## Changing the Compression Library
108+
109+
It is possible to use the compression library 'Snappy' on Hypernode.
110+
111+
In order to use the compression library Snappy for your Valkey cache you can run the following commands:
112+
113+
```console
114+
$ bin/magento setup:config:set --cache-backend-redis-compression-lib=snappy
115+
$ # If you use Magento's builtin page cache
116+
$ bin/magento setup:config:set --page-cache-redis-compression-lib=snappy
117+
```
118+
119+
## Configure Magento 2 to Use Valkey as the Session Store
120+
121+
You can use Valkey for storing sessions too.
122+
123+
### Configure Magento 2 to Store Sessions in Valkey
124+
125+
Run the following command:
126+
127+
```console
128+
$ cd /data/web/magento2
129+
$ bin/magento setup:config:set --session-save=redis --session-save-redis-host=redismaster --session-save-redis-db=3
130+
```
131+
132+
Now flush your cache:
133+
134+
```console
135+
$ redis-cli flushall
136+
# or
137+
$ valkey-cli flushall
138+
```
139+
140+
### Enable Second Valkey Instance for Sessions
141+
142+
Enable the second instance for sessions:
143+
144+
```console
145+
$ hypernode-systemctl settings redis_persistent_instance True
146+
```
147+
148+
After enabling the second instance change the session port to `6378` and the database to `0`:
149+
150+
```console
151+
$ cd /data/web/magento2
152+
$ bin/magento setup:config:set --session-save-redis-port=6378 --session-save-redis-db=0
153+
```
154+
155+
Furthermore you can add the following line to your crontab to take periodic background snapshots:
156+
157+
```
158+
* * * * * redis-cli -p 6378 bgsave
159+
# or
160+
* * * * * valkey-cli -p 6378 bgsave
161+
```
162+
163+
### Test Whether Your Sessions Are Stored in Valkey
164+
165+
To verify whether your configuration is working properly, first clear your filesystem session store:
166+
167+
```console
168+
$ rm /data/web/public/var/sessions/*
169+
```
170+
171+
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:
172+
173+
```console
174+
$ redis-cli -n 0 keys '*'
175+
# or
176+
$ valkey-cli -n 0 keys '*'
177+
```

documentation_urls.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-the-ret
8686
article: https://support.hypernode.com/en/ecommerce/magento-1/how-to-set-up-a-staging-environment-for-magento-1/
8787
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-change-your-magento-2-base-urls/
8888
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-redis-for-magento-2/
89+
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-valkey-for-magento-2/
8990
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-configure-varnish-for-magento-2-x/
9091
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-robots-txt-for-magento-2-x/
9192
article: https://support.hypernode.com/en/ecommerce/magento-2/how-to-create-a-sitemap-xml-for-magento-2-x/

0 commit comments

Comments
 (0)