1. 程式人生 > >Redis 服務端配置——Could not connect to Redis at 127.0.0.1:6379: Connection refused

Redis 服務端配置——Could not connect to Redis at 127.0.0.1:6379: Connection refused

[root@centoszang 桌面]# redis-cli
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
not connected> exit
[root@centoszang 桌面]# redis-server /etc/redis.conf
[root@centoszang 桌面]# redis-cli
127.0.0.1:6379> 
複製程式碼

在使用Redis時,開始就遇到了問題,客戶端打不開,原因是需要先開啟服務端,這需要先配置——

1.下載好redis安裝包,解壓安裝之後,複製其配置檔案redis.conf 到etc 資料夾下

  cd /opt/redis-3.2.8

  cp redis.conf /etc

2. 進入etc,找到redis.conf 並修改 daemonize no(第128行) 為 daemonize yes ,這樣就可以預設啟動就後臺執行

3. 開啟客戶端要確保服務端啟動       

  redis-server /etc/redis.conf

4.啟動客戶端不成功要退出再進行下一步