Laravel Homestead Redis Port Forwarding

Rafael Beckel picture Rafael Beckel · Jul 4, 2015 · Viewed 13.4k times · Source

I'm having some trouble here trying to remotely connect to my local Homestead Redis server. I'm using both commandline (redis-cli) and RDM.

I'm able to connect with Postgresql with PgAdmin in this box, but Redis returns with:

Could not connect to Redis at 127.0.0.1:63790: Connection refused

My Redis config file "bind" directive is commented, so it should accept connections from all sources. I also tried to stop Redis and start it again, manually pointing to the config file, but without success.

In my Homestead.yaml config file, Redis port was not forwarded by default. According to Homestead's Documentation, I can set port forwarding like this:

ports:
    - send: 63790
      to: 6379
      protocol: udp

Well, I also tried that and restarted the server, but it didn't work.

Am I missing something?

Answer

Shiro picture Shiro · May 5, 2016

For Homestead 0.4 above. Due to redis security setting, it bind only for 127.0.0.1

In this case, you need to bind extra IP address.

  1. SSH to you server.

$sudo vi /etc/redis/redis.conf

Scroll to the line bind 127.0.0.1 add extra IP address 192.168.10.10, it will look like this

bind 127.0.0.1 192.168.10.10

save and exit.

  1. Restart redis server and exit your server.

$sudo /etc/init.d/redis-server restart

That's all, you should be able connect to your Homestead redis from your host.