5

I tried to forward guest port 6379 to host 6379 and to 16379 but with no luck.

I can connect to redis from guest and set and get, and despite I also can connect to redis from host and get help, I cannot set or get.

I got no firewall running on guest, or host. Any help appreciated.

From host:

host: > redis-cli -h localhost -p 16379
localhost:16379> help
redis-cli 2.8.4
Type: "help @<group>" to get a list of commands in <group>
      "help <command>" for help on <command>
      "help <tab>" to get a list of possible help topics
      "quit" to exit
localhost:16379> help get

  GET key
  summary: Get the value of a key
  since: 1.0.0
  group: string

localhost:16379> get 'x'
Error: Connection reset by peer
localhost:16379> set 'x' 12
Error: Connection reset by peer

From guest:

vagrant:~$ redis-cli -v
redis-cli 2.8.4
vagrant:~$ redis-cli
127.0.0.1:6379> set 'x' 12
OK
127.0.0.1:6379> get x
"12"
zuba
  • 2,373
  • 4
  • 33
  • 55
  • Found the answer on stackoverflow, but cannot close as the answer should exist on askubuntu http://stackoverflow.com/questions/8537254/redis-connect-to-remote-server – zuba Jul 06 '15 at 09:36

1 Answers1

6

The solution is here : check your /etc/redis/redis.conf, and make sure to change the default

bind 127.0.0.1

to

bind 0.0.0.0

Then restart your service service redis-server restart

You can then now check that redis is listening on non-local interface with

zuba
  • 2,373
  • 4
  • 33
  • 55
  • 1
    I think this solution is good, I have to do the same thing for Flask applications which by default run on 127.0.0.1 even though I forward the port I cannot access them until I bind the application to listen on any interface (0.0.0.0) – levlaz Jul 06 '15 at 14:17