I have installed and configured Redis Cache with Magento2 and its working fine. For that, I added the config data in app/etc/env.php file. Now I am trying to configure Redis Cluster with Magento2 and checking how to do the configuration.
Can anyone please tell me how to configure Redis Cluster with Magento2.
Thanks.
Hi @anzbmuhammad,
Redis Cluster configuration for Magento 2 is the same as non-cluster.
Just specify host and port of entry point to your cluster, no additional configuration required.
The difference of cluster and non-cluster will be handled by Redis itself.
How to configure on env.php for redis cluster array { host1:6379, host2:6379,host3:6379}?
thanks
Norman
I'm not sure what are those three hosts. If these are interfaces of one redis cluster you probably can distribute their usage depending on the location of your application web node relatively to Redis node.
Also, make sure to use different Redis db for cache and session storage.
Please take a look at the Magento documentation for examples of configuration http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html
My company platform team have deployed redis cluster on 3 nodes (10.193.1.1, 10.193.1.2,10.193.1.3) for port 6379.
I have update the env.php to redis as following
......
....
array (
'backend'=> 'Cm_cache_backend_Redis',
'backend_options' =>
array (
'server' => '10.193.1.1',
'port'=>'6379',
......),
array (
'server' => '10.193.1.2',
'port'=>'6379',
......),
array (
'server' => '10.193.1.3',
'port'=>'6379',
......),
Then it show error on /etc/httpd/logs/ssl_error_log
CredisException: ERR select is not allowed in cluster mode
The website could not open ERROR 500
Any suggestion for this?
Thanks
Norman
I have entered the host and port details of entry point to my cluster and after that I am getting error as follows.
Fatal error: Uncaught exception 'CredisException' with message 'CROSSSLOT Keys in request don't hash to the same slot' in /opt/lampp/htdocs/myproject/lib/internal/Credis/Client.php:1022 Stack trace: #0 /opt/lampp/htdocs/myproject/lib/internal/Credis/Client.php(788): Credis_Client->read_reply('sinter') #1 /opt/lampp/htdocs/myproject/lib/internal/Cm/Cache/Backend/Redis.php(742): Credis_Client->__call('sInter', Array) #2 /opt/lampp/htdocs/myproject/lib/internal/Cm/Cache/Backend/Redis.php(742): Credis_Client->sInter(Array) #3 /opt/lampp/htdocs/myproject/lib/internal/Cm/Cache/Backend/Redis.php(425): Cm_Cache_Backend_Redis->getIdsMatchingTags(Array) #4 /opt/lampp/htdocs/myproject/lib/internal/Cm/Cache/Backend/Redis.php(654): Cm_Cache_Backend_Redis->_removeByMatchingTags(Array) #5 /opt/lampp/htdocs/myproject/vendor/magento/zendframework1/library/Zend/Cache/Core.php(465): Cm_Cache_Backend_Redis->clean('matchingTag', Array) #6 /opt/lampp/htdocs/myproject/vendor/magento/framework/Cache/Core.php(98): Zend_Cache_Core->clean('matchingTag', Array) #7 /opt/lam in /opt/lampp/htdocs/myproject/vendor/magento/zendframework1/library/Zend/Cache.php on line 209
Can you please tell me how to fix this?
Thanks