I have two servers containing the same laravel application and both are connected with a load balancer. Everything works well with the same RDS. To make the site faster I have created a Redis cluster on Elasticache and added the endpoint on the servers.
To configure the Redis PHP has predis for it. I unassigned a server from the load balancer and configured the server one by one. The fast server worked but the second server is not working. While I configure the first server the server sends data on the Redis cluster to save some data on the cluster while I configure the second one couldn't be able to fetch those data and use it as it's own. So it gives me
moved 6379 ....something
for this, I was not been able to use the second server while enabling Redis. Though the first server is doing great with redis no problem with that. But i was not being able to use redis on second server. Can anyone help me with this? I want to make two servers working together with the same redis cluster.
Here is my redis config

    'redis' => [

        'client' => 'predis',

        'default' => [
            'host' => env('REDIS_HOST', ''),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,

  • maybe you need to have the .env file in both servers, from the second server you could try telnet redis_cluster_hostname 6379 to check if the connections works
    – c4f4t0r
    Sep 26 '20 at 8:28
  • i have .env file on both servers, i also can access the redis client from both of the servers. but whenever i try to generate a key using php artisan key:generate the log show me error MOVED Sep 26 '20 at 9:39
  • did you try to use the same APP_KEY in both servers?
    – c4f4t0r
    Sep 26 '20 at 14:53
  • Does this answer your question? Redis Cluster: (error) MOVED Sep 26 '20 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.