[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.啟動客戶端不成功要退出再進行下一步