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

William

Installed a redis in ubuntu 16.4 in digitalocean.

I've changed the default redis server 127.0.0.1:6379 into my own ip in digitalocean 178.xxx.xxx.xxx:6379 by editing editing vim /etc/redis/redis.conf

After that I tried redis-cli and redis-cli shutdown all responded this: Could not connect to Redis at 127.0.0.1:6379: Connection refused

But if ps aux|grep redis

I get:

redis    11734  0.0  0.1  41852  3892 ?        Ssl  15:45   0:11 /usr/local/bin/redis-server 178.xxx.xxx.xxx:6379
root     12735  0.0  0.0  12944   948 pts/0    S+   19:11   0:00 grep --color=auto redis

Is this normal?Or what should I do?

Mark Setchell

What you should do depends on how you want it to work...


If you want to be able to connect to Redis via any network interface, comment out all the bind directives in your config file by putting a # at the start of the line beginning bind.


If you want to only be able to connect by specifying 178.xxx.xxx.xxx, then put the following in your config file:

bind 178.xxx.xxx.xxx

If you want to use 127.0.0.1 or 178.xxx.xxx.xxx, then put:

bind 178.xxx.xxx.xxx 127.0.0.1

I'm guessing you want this option, but see security note below.


In general though, it is not advisable from a security point of view, to expose your Redis server to the whole Internet - and all the options above do exactly that. You probably want to bind to 127.0.0.1 and set up an ssh tunnel from your 178.xxx.xxx.xxx public address to 127.0.0.1.

Whatever you put in there, restart Redis to make changes take effect.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

redis: dial tcp [REDIS ADDRESS] connect: connection refused

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

PG::ConnectionBad - could not connect to server: Connection refused

Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it

Heroku: PG::ConnectionBad: could not connect to server: Connection refused

Laravel : Redis No connection could be made : [tcp://127.0.0.1:6379]

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

Redis error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379

Could not connect to Redis at 127.0.0.1:0: Connection refused (when using init script to shut down a redis server w/ unix socket)

Cannot connect to redis://localhost:6379/0: Error 99 connecting to localhost:6379. Cannot assign requested address

org.apache.http.conn.HttpHostConnectException: Connect to localhost:19538 [localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)

Connection refused [tcp://127.0.0.1:6379] Laravel 5.6

Connection refused: localhost/0:0:0:0:0:0:0:1:9000 with gRPC

Could not connect to server: Connection refused (0x0000274D/10061) - PostgreSQL on remote server

Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 nodejs

docker-compose + django + redis - Error 111 connecting to 127.0.0.1:6379. Connection refused

docker build error: psql: could not connect to server: Connection refused

WSL - GEDIT Unable to init server: Could not connect: Connection refused

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Heroku

Error occured with redis HMSEET, dial tcp :6379: connect: connection refused

Fail to connect to Redis in Kubernetes: Redis connection to localhost:6379 failed

Could not connect to the database Network error IOException: Connection refused: connect

Failed to get bus connection: Could not connect: Connection refused

PG::ConnectionBad: could not connect to server: Connection refused

No connection could be made because the target machine actively refused it TCP:0 Visual Studio

Ubuntu 18.04 abiword - Unable to init server: Could not connect: Connection refused

django.db.utils.OperationalError: could not connect to server: Connection refused

rake aborted! PG::ConnectionBad: could not connect to server: Connection refused

Error dial tcp 127.0.0.1:6379: connect: connection refused when starting Redis container without Docker Compose