Hi there.
I re-post this question because my last post has been tagged as spam (??)
I properly installed Varnish on my M2 instance,
I activated activated Redis for sessions handling, default, but when i try to configure Magento to use Redis for full page caching , I get this error:
bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=1 --cache-backend-redis-password=XXX
Invalid Redis configuration. Could not connect to Redis server. In ConfigSetCommand.php line 150: Parameter validation failed
It seems I'm unable to reach Redis server, but it is ok for sessions and default.
This is the content of my install dir>app/etc/env.php
<?php return [ 'backend' => [ 'frontName' => 'admin_XXX' ], 'crypt' => [ 'key' => 'XXX' ], 'db' => [ 'table_prefix' => '', 'connection' => [ 'default' => [ 'host' => 'localhost', 'dbname' => 'optosigma', 'username' => 'optosigma', 'password' => 'XXX', 'model' => 'mysql4', 'engine' => 'innodb', 'initStatements' => 'SET NAMES utf8;', 'active' => '1' ] ] ], 'resource' => [ 'default_setup' => [ 'connection' => 'default' ] ], 'x-frame-options' => 'SAMEORIGIN', 'MAGE_MODE' => 'developer', 'session' => [ 'save' => 'files' ], 'cache' => [ 'frontend' => [ 'default' => [ 'id_prefix' => '4cf_', 'backend' => 'Cm_Cache_Backend_Redis', 'backend_options' => [ 'server' => '127.0.0.1', 'database' => '0', 'port' => '6379', 'password' => 'XXX' ] ], 'page_cache' => [ 'id_prefix' => '4cf_' ] ] ], 'cache_types' => [ 'config' => 0, 'layout' => 0, 'block_html' => 0, 'collections' => 0, 'reflection' => 0, 'db_ddl' => 0, 'compiled_config' => 1, 'eav' => 0, 'customer_notification' => 0, 'config_integration' => 0, 'config_integration_api' => 0, 'full_page' => 0, 'config_webservice' => 0, 'translate' => 0, 'vertex' => 0 ], 'install' => [ 'date' => 'Mon, 27 May 2019 12:39:19 +0000' ] ];
Redis server is binded to localhost, on the same server.
Maybe I'm wrong but think that the Varnish Cache and the Redis full page cache are not redundant on Magento 2. So I should be able to activate both.
I believe Redis page cache and Varnish page cache serve the same purpose therefore you would use one or the other but not both. I would remove the page_cache section from env.php and use Varnish only.
Hey!
Which hosting provider are you using? If you have hosted somewhere on managed hosting you get the feature of enabling Redis cache via hosting platform. Please check that one as well.
If you still have any queries, feel free to ping me.
Replace your command with following
bin/magento setup:config:set --page-cache=redis --page-cache-redis-server=127.0.0.1 --page-cache-redis-db=1 --page-cache-redis-password=XXX
It will work for you.
Thanks