Laravel Homestead Redis Port Forwarding

I'm having trouble trying to connect remotely to the local Homestead Redis server. I use both the command line (redis-cli) and RDM .

I can connect to Postgresql using PgAdmin in this field, but Redis returns with:

Failed to connect to Redis at 127.0.0.1:63790: connection rejected

The "binding" directive to my Redis file has been commented, so it should accept connections from all sources. I also tried stopping Redis and starting it again, manually pointing to the configuration file, but without success.

In my Homestead.yaml configuration file, the Redis port was not redirected by default. According to the documentation of the Homestead Documentation , I can configure port forwarding as follows:

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

Well, I also tried this and restarted the server, but it did not work.

Did I miss something?

+5
source share
3 answers

Remove the port settings from Homestead.yaml , you won’t need it.

Now, by default, redis in homestead vm listens on its regular port, 6379.

You can ssh into your vm and check it out:

  vagrant@homestead : ~ $ ps -aux |  grep redis
 redis 996 0.1 0.4 35 232 8752?  Ssl 01:53 0:00 / usr / bin / redis-server *: 6379

To connect to the vm redis instance from your local computer, you need to use the IP address provided in your Homestead.yaml . The default is 192.168.10.10 :

 redis-cli -h 192.168.10.10 

If you have a domain name configured in local /etc/hosts for your application, you can use it instead:

 redis-cli -h homestead.app 
+3
source

For Homestead 0.4 above. Due to the redis security setting, it only communicates with 127.0.0.1

In this case, you need to associate an additional IP address.

  • SSH for the server.

$sudo vi /etc/redis/redis.conf

Select the line bind 127.0.0.1 add an additional 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 the redis server and exit your server.

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

To do all this, you should be able to connect to your Homestead redis from your host.

+24
source

SSH to the machine and open /etc/redis/redis.conf .

Find the line starting with the bind directive, comment on it and save the file. Then restart the redis server using sudo /etc/init.d/redis-server restart .

Due to the fact that Redis will listen to all connections of all available interfaces. You do not need additional port forwarding.

+2
source

All Articles