今天嘗試連接redis時,出現了如下的問題:
Could not connect to Redis at 127.0.0.1:6379: Connection refused
解決方案:
1.找到redis.conf配置文件,並使用vim命令打開並修改里面的配置,將daemonize no 修改為daemonize yes,這樣默認在后台啟動運行
vim redis.conf
2.通過開啟客戶端來確保我們的服務器是啟動狀態的! ps:注意下面的/opt/redisconfig/redis.conf,是我的redis配置路徑,請大家根據自己實際軟件路徑來編寫
redis-server /opt/redisconfig/redis.conf
3.可以在使用ps命令查看端口號是否存在運行
ps -ef|grep redis
4.最后進行客戶端的連接,進行訪問。redis-cli -p 6379
出現如下圖說明連接成功