Redis连接时报错:Could not connect to Redis at 127.0.0.1:6379: Connection refused

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redis连接时报错:Could not connect to Redis at 127.0.0.1:6379: Connection refused相关的知识,希望对你有一定的参考价值。

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

[[email protected] bin]# redis-cli 
Could not connect to Redis at 127.0.0.1:6379: Connection refused
[[email protected] /]# redis-server /etc/redis.conf 
[[email protected] /]# redis-cli 
redis 127.0.0.1:6379>

在安装好redis扩展 尝试连接redis时,客户端打不开,原因是需要先开启服务端,这需要先配置——

1.找到redis.conf 并修改 daemonize no 为 daemonize yes ,这样就可以默认启动就后台运行

[[email protected] conf.d]# vi /etc/redis.conf 

2.开启客户端要确保服务端启动

[[email protected] /]# redis-server /etc/redis.conf

3.启动客户端不成功要退出再进行下一步

现在就可以正常访问了

[[email protected] /]# redis-server /etc/redis.conf 
[[email protected] /]# redis-cli 
redis 127.0.0.1:6379>

  

以上是关于Redis连接时报错:Could not connect to Redis at 127.0.0.1:6379: Connection refused的主要内容,如果未能解决你的问题,请参考以下文章

java 连接 redis集群时报错:Could not get a resource from the pool

使用 Gradle 编译 Java 项目时报错: Could not find Tools.jar

eclipse启动时报错 Could not create the java virtual machine

NFS启动时报错Linux NFS:could not open connection for tcp6

android studio集成腾讯云通信时报错,could not expand zip imsdk.jar

Linux 启动 Apache 时报错:(98)Address already in use: make_sock: could not bind to address [::]:80