Set up Valkey service
CREATED FOR:
- Admin
- Developer
Valkey is an optional, backend cache solution that replaces the Zend Framework Zend_Cache_Backend_File
, which Adobe Commerce uses by default.
See Configure Valkey in the Configuration guide.
Use the following instructions for service setup on Pro Integration environments and Starter environments, including the master
branch.
To enable Valkey:
-
Add the required name and type to the
.magento/services.yaml
file.cache: type: valkey:<version>
To provide your own Valkey configuration, add a
core_config
key in your.magento/services.yaml
file:cache: type: valkey:8.0
-
Configure the relationships in the
.magento.app.yaml
file.relationships: valkey: "cache:valkey"
-
Add, commit, and push your code changes.
git add .magento/services.yaml .magento.app.yaml && git commit -m "Enable valkey service" && git push origin <branch-name>
services.yaml
and .magento.app.yaml
configuration files. See Change service version for guidance on upgrading or downgrading a service.Using the Valkey CLI
Assuming your Valkey relationship is named valkey
, you can access it using the valkey-cli
tool.
-
Use SSH to connect to the integration environment with Valkey installed and configured.
-
Open an SSH tunnel to a host.
valkey-cli -h valkey.internal
Get installed Valkey version
Use the following command to get the Valkey version installed on an integration environment:
valkey-cli -h valkey.internal info | grep version
Response:
valkey_version:8.0.1
gcc_version:12.2.0
Valkey on Pro staging and production
To get the Valkey version installed on a Staging or Production environment, use the valkey-server
command:
valkey-server -v
Valkey server v=8.0.1 ...
Use the following command to get the Valkey configuration installed on a Pro Staging or Production environment:
echo $MAGENTO_CLOUD_RELATIONSHIPS | base64 -d | json_pp
Response:
"valkey" : [
{
"cluster" : "project-master-abc0003",
"epoch" : 0,
"fragment" : null,
"host" : "valkeycache.internal",
"host_mapped" : false,
"hostname" : "oblahblahblahblahe.cache.service._.magentosite.cloud",
"instance_ips" : [
"123.456.789.012"
],
"ip" : "123.456.789.012",
"password" : null,
"path" : null,
"port" : 6379,
"public" : false,
"query" : {},
"rel" : "valkey",
"scheme" : "valkey",
"service" : "cache",
"type" : "valkey:8.0",
"username" : null
}
]