New issue 497 by iandenni...@gmail.com: Bind to two or more interfaces
without binding to all interfaces (enhancement request)
http://code.google.com/p/redis/issues/detail?id=497
What version of Redis you are using, in what kind of Operating System?
2.2.2, on Linux (Debian, Ubunto) and OS X
What is the problem you are experiencing?
I would like to bind to localhost as well as a VPN interface, without
having to bind to 0.0.0.0. This is an enhancement request.
What steps will reproduce the problem?
If two bind configuration directives are provided, it appears to honor the
last entry, only. Providing a comma-separated list of IP addresses to bind
results in a "wrong number of arguments error" I didn't expect any of this
to work; the comments in the default config are pretty clear... but I was
hopeful that redis honoured some of the common conventions for specifying
multiple IP addresses.
Please provide any additional information below.
So obviously, the expected use is to provide a single IP address, or to
bind to all. Like I said, I want to bind to localhost (so I can connect
from my app server) but also bind to a VPN interface (so I can debug over
the VPN, and eventually connect several redis instances without using a
publicly routable address.) I realize I can change my app code to use the
VPN interface instead of localhost, but I would prefer to avoid that
because my staging server has a different IP than my production server, and
I can keep my configuration consistent across both by simply pointing redis
to localhost.
There are several possible workarounds:
1/ you bind on your vpn address, and you define a
Unix socket for your local connections. As a bonus,
your app server connections to Redis will be faster.
2/ you bind on localhost, so your app can access Redis,
and you run a proxy listening to the vpn address. For
instance, haproxy in TCP mode seems to work quite well
with Redis, and is quite easy to install.
http://haproxy.1wt.eu/
Example of haproxy configuration:
global
daemon
maxconn 1024
defaults
mode tcp
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend redis
bind *:1521
default_backend servers
backend servers
server R1 127.0.0.1:6379 maxconn 1000
Regards,
Didier.
Hey - those are good workarounds. I think I'm going to implement #1 almost
immediately. I guess I don't actually have any further need to bind to
multiple interfaces, so ... thanks!
Comment #3 on issue 497 by pcnoordh...@gmail.com: Bind to two or more
interfaces without binding to all interfaces (enhancement request)
http://code.google.com/p/redis/issues/detail?id=497
As clear from the behavior Redis shows when using multiple bind statements
in the config; Redis only binds to a single address. Thanks for your
suggestion Didier! This is a great way to solve this (as this will not be
natively supported by Redis).