Re: when launching redis-cli, I get error "Could not connect to Redis at 127.0.0.1:6379: Connection refused"

10,728 views
Skip to first unread message

Felix Gallo

unread,
Nov 6, 2012, 11:11:27 AM11/6/12
to redi...@googlegroups.com
Can you ping 127.0.0.1?  It's possible that you accidentally screwed up iptables (or whatever firewall you're using).

F.


On Tue, Nov 6, 2012 at 8:05 AM, Larry Chisholm <goal...@gmail.com> wrote:
Running Ubuntu 12.04, and redis 2.6.2

@SERVER:~# service redis-server status
redis-server is running

redis.conf binds service to it's proper ip address of 10.x.x.x

If I do a  ./redis-cli -h 10.x.x.x   it works correctly.   If I connect from another host, it works correctly.

Any assistance would be greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/eLSiAUMVDdMJ.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

Greg Andrews

unread,
Nov 6, 2012, 11:29:47 AM11/6/12
to redi...@googlegroups.com

If you tell Redis to listen on just one specific address like 10.x.x.x, that's what it will do.  It won't be available on other addresses like 127.0.0.1.

If you want it available on all the server's addresses, then set the redis.conf file to make it bind to 0.0.0.0.

If you want it available on some of the server's addresses but not others, you can't accomplish that with just the redis.conf file.  You would have to use 0.0.0.0 in redis.conf and block port 6379 for the undesirable addresses in iptables or your operating system's firewall features/software.

  -Greg

Tim Lossen

unread,
Nov 6, 2012, 11:30:21 AM11/6/12
to redi...@googlegroups.com
do you have a "bind 10.x.x.x" line in your redis.conf?
if yes, redis binds *only* to the given interface.


On 2012-11-06, at 17:05 , Larry Chisholm wrote:

> Running Ubuntu 12.04, and redis 2.6.2
>
> @SERVER:~# service redis-server status
> redis-server is running
>
> redis.conf binds service to it's proper ip address of 10.x.x.x
>
> If I do a ./redis-cli -h 10.x.x.x it works correctly. If I connect from another host, it works correctly.
>
> Any assistance would be greatly appreciated.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Redis DB" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/eLSiAUMVDdMJ.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.

--
http://tim.lossen.de



Larry Chisholm

unread,
Nov 6, 2012, 12:45:14 PM11/6/12
to redi...@googlegroups.com
Correct.   I did have 10.x.x.x tied in. binding 0.0.0.0 works, but shouldn't I be seeing the server name instead of 127.0.0.1 ?    I see that in my redis 2.2 versions.

Greg Andrews

unread,
Nov 6, 2012, 9:43:47 PM11/6/12
to redi...@googlegroups.com
The redis-cli.c code for deciding the hostname/ip address to connect is pretty much the same in v2.2.x and v2.6.x.  It doesn't read the redis server's config file.  It uses your -h argument or 127.0.0.1.

So my answer to your question is:  I think there's a wrapper script or shell alias on your redis 2.2 machines that's supplying the -h hostname argument for you, and it doesn't exist on your redis 2.6 machine(s) yet.

  -Greg

To view this discussion on the web visit https://groups.google.com/d/msg/redis-db/-/AZIqE6grX1kJ.
Reply all
Reply to author
Forward
0 new messages