简体   繁体   中英

Error connecting to my redis server from my code

io.adapter(redis({ host: config.redisHost, port: config.redisPort }));

Both the confif.redisHost and config.redisPort are the correct values, but when I try to connect from my code I get the error -

'Error: Redis connection to 104.xxx.xx.xxx:6379 failed - connect ECONNREFUSED 104.xxx.xx.xxx:6379'

In redis.conf I've changed the bind to 0.0.0.0 as well as removing it completely and I've also tried setting protected mode to off just to try and get the connection working.

The IP and port are definitely, correct. Does anyone know why I might not be able to access the server from my code? My code is just being ran on my local machine and the redis server is being ran on a digital ocean ubuntu 14.04 machine. The status of the server is definitely running and I can access the redis-cli from the machine itself.

由于某种原因,当我尝试启动服务器时没有使用redis.conf,我不得不手动告诉它在启动时使用它,现在它可以工作了。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM