浏览文章
文章信息
Magento2 session 缓存到redis|Magento2 session to redis|配置session缓存
11935
一、两种设置方式
第一种、命令
bin/magento setup:config:set --session-save=redis --session-save-redis-host=127.0.0.1 --session-save-redis-log-level=3 --session-save-redis-db=2
第二种、修改app/etc/env.php
找到session配置项
修改成
'session' => array ( 'save' => 'redis', 'redis' => array ( 'host' => '127.0.0.1', 'port' => '6379', 'password' => '', 'timeout' => '2.5', 'persistent_identifier' => '', 'database' => '2', 'compression_threshold' => '2048', 'compression_library' => 'gzip', 'log_level' => '4', 'max_concurrency' => '6', 'break_after_frontend' => '5', 'break_after_adminhtml' => '30', 'first_lifetime' => '600', 'bot_first_lifetime' => '60', 'bot_lifetime' => '7200', 'disable_locking' => '0', 'min_lifetime' => '60', 'max_lifetime' => '2592000' ) ),
二、验证
删除var/session/下所有缓存
根目录执行
rm -rf var/session/*然后,访问网页,如果没有生成session缓存,说明OK!