Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
267,436
Solution 1
After you install redis, type from terminal:
redis-server
and you'll have redis running
Solution 2
I solve this problem in next way:
sudo apt-get install redis-server
then run command to confirm that everything ok:
sudo service redis-server status
And the output will be: redis-server is running
- that means that the problem is solved.
Solution 3
Install redis on your system first -
brew install redis
then start the redis server -
redis-server
Solution 4
I'm on windows, and had to install Redis from here and then run redis-server.exe
.
From the top of this SO question.
Solution 5
Simple solution:
only hit below commend once and restart your server again
redis-server
Related videos on Youtube
Author by
Huy Tran
Updated on July 28, 2022Comments
-
Huy Tran almost 2 years
I working with node.js by expressjs
I try to store an account to session. So, i try to test to use session with code in expressjsvar RedisStore = require('connect-redis')(express); app.use(express.bodyParser()); app.use(express.cookieParser()); app.use(express.session({ secret: "keyboard cat", store: new RedisStore }));
but I got error
Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
.
Please help me resolve this problem-
a sad dude over 12 yearsIs Redis running? Can you connect to it by other means e.g. redis-cli?
-
Huy Tran over 12 yearsThank u, because redis server not running. I install redis-server follow this tutorial
-
Emad Aghaei about 6 yearsYou should instal Redis server on your machine and rune it. I donot know why the author doesn't mentioned this important thing in the manual!
-
amar ghodke over 5 yearsHow do I add redis-server for my node Heroku app? I also have same error.
-
-
Romans 8.38-39 almost 10 yearsFor me, I should specify the conf, so I type >> (sudo) redis-server /etc/redis/redis.conf
-
vineet over 8 yearsthat error fixed but now new error show i.e, "Error: ERR wrong number of arguments for 'set' command"
-
Dropout over 8 yearsPlease explain your answer. It is currently viewed as a low quality post. Thanks!
-
Balakumaran over 8 yearsi got this error in ubuntu...solve with this commands..now it's working fine .....
-
Codious-JR about 8 yearsThank you. Stupid how in the tutorial they never mentioned how to start the redis server!
-
Morteza about 7 years
redis-server --daemonize yes
to run in background -
just-be-weird about 4 yearsThanks! this resolved the issue, just a small note on Linux/WSL environments after installing re-run the command
redis-server
or prefix it by sudo if needed. If all goes well, you will see redis-server cli message. also can be verified bysudo service redis-server status
as suggested by @author. -
lukas_o almost 4 yearsBe aware: This will take some time to run. If you have a dependency manager (brew or other) this will save you time.
-
Edison Pebojot about 3 years@morteza-ziyae How do I stop redis server in the background?
-
kiranr over 2 yearsthank you it fixed my issue, don't know why it is not taking port and host as input
-
MartianMartian about 2 yearsbrew services start redis is better