-
Notifications
You must be signed in to change notification settings - Fork 35
add valkey docs #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
EoghanHyper
wants to merge
11
commits into
master
Choose a base branch
from
valkey-docs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
add valkey docs #405
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6396a80
add valkey docs
eoghanteamblue 395dc0d
precommit
eoghanteamblue 2ae2c3b
Update docs/best-practices/performance/how-to-optimize-the-performanc…
EoghanHyper 8395b8d
Update docs/ecommerce-applications/magento-2/how-to-configure-redis-f…
EoghanHyper 0c73ffb
Merge branch 'master' into valkey-docs
meichelsheimteamblue 5547102
Update documentation
meichelsheimteamblue 68319ee
Remove duplicate valkey <> redis documentation
meichelsheimteamblue 207a6c4
Remove valkey docs uri and redirect links
meichelsheimteamblue 5e12a47
Update docs/ecommerce-applications/magento-2/how-to-configure-redis-f…
martijneichelsheim a95111b
Update docs/ecommerce-applications/magento-2/how-to-configure-redis-f…
martijneichelsheim 61000bb
Update docs/ecommerce-applications/magento-2/how-to-configure-redis-f…
martijneichelsheim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
177 changes: 177 additions & 0 deletions
177
docs/ecommerce-applications/magento-2/how-to-configure-valkey-for-magento-2.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 '*' | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.