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

Created on 14 Apr 2012  ·  3Comments  ·  Source: redis/redis

Hi Redis Core Team,

In order to feel the power of redis, I have already set up a security group with the port 6379 in amazon ec2.

Under the redis-stable/src directory in my ec2 instance via either putty.exe or nxclient, I have tried to start the redis console by using redis-cli , redis-cli -p 3000 -h my ip address, redis-cli -p 6379 -h my ip address, redis-cli -p 80 -h 127.0.0.1 , redis-cli -p 3000 -h 127.0.0.1 and redis-cli -p 6379 -h 127.0.0.1 , redis-cli -p 3000 and redis-cli -p 6379...

But all in vain. All I got is the message below:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>

And when I use redis-cli -p 80 -h my ip address and redis-cli -p 80,
I can log in, but when I type "ping" to see if it works or not. I got the message below:
Error: Protocol error, got "<" as reply type byte

Kindly wonder what I have done wrong. Any help appreciated here please. Thanks.

Most helpful comment

Refer to https://github.com/antirez/redis, I found that I need to start a redis-server instance first by typing redis-server before typing redis-cli in ANOTHER terminal.

Playing with Redis


You can use redis-cli to play with Redis. Start a redis-server instance,
then in another terminal try the following:

% cd src
% ./redis-cli
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis> 

All 3 comments

Refer to https://github.com/antirez/redis, I found that I need to start a redis-server instance first by typing redis-server before typing redis-cli in ANOTHER terminal.

Playing with Redis


You can use redis-cli to play with Redis. Start a redis-server instance,
then in another terminal try the following:

% cd src
% ./redis-cli
redis> ping
PONG
redis> set foo bar
OK
redis> get foo
"bar"
redis> incr mycounter
(integer) 1
redis> incr mycounter
(integer) 2
redis> 

Great. But what about on Windows?

@maelfyn can you be more specific about the question? What do you mean, in terms of the conversation you have resurrected? The conclusion there was: start a redis server before you try to connect to it as a client. That applies equally on Windows. Note that the primary redis project doesn't target windows, but there are a number of ways of using redis on Windows (I do this regularly).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

p-run picture p-run  ·  4Comments

elog08 picture elog08  ·  3Comments

asleire picture asleire  ·  3Comments

steadyrun picture steadyrun  ·  4Comments

ET-CS picture ET-CS  ·  4Comments