Magento2 Redis

Redis + Magento 2

First install redis yum install redis
Make sure it is running systemctl status redis
Configure magento to use redis for caching

1
2
bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=1
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
If the firs command fails, check why redis is not working
Clear magento cache and session folders
1
2
3
\rm var/session/*
\rm var/cache/*
\rm -rf var/cache/*
Click around the site make sure adding products to cart is working. Check that magento session folder is not being used anymore and also that the cache folder stores only the minimum required
1
2
3
4
5
ll var/session/
ll var/cache/
tree var/cache/
find var/cache/
find var/cache/ | wc -l