Redis安裝配置記錄

Redis用來替代ehcahce,memcache等緩存模塊,最好不過了,安裝和配置redis的資料網絡上很多,

這裏就大概的寫一下我遇到的一些問題。

1.(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

Redis被配置爲保存數據庫快照,但它目前不能持久化到硬盤。用來修改集合數據的命令不能用。請查看Redis日誌的詳細錯誤信息。

原因:

強制關閉Redis快照導致不能持久化。

解決方案:

運行config set stop-writes-on-bgsave-error no 命令後關閉配置項stop-writes-on-bgsave-error解決該問題。

root@atwl:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> lpush myColour "red"
(integer) 1

2. 客戶端連接一直報錯:redis.clients.jedis.exceptions.JedisConnectionException:java.net.ConnectException: Connection refused: connect

原來是redis默認只能localhost登錄,所以需要開啓遠程登錄。解決方法如下:

在redis的配置文件redis.conf中,找到#bind localhost註釋掉。

3、我的操作系統是centos,由於防火牆沒有開放6379端口,導致連接超時

firewall-cmd --permanent --zone=public --add-port=6379/tcp
firewall-cmd --permanent --zone=public --remove-port=6379/tcp 禁用端口


4、(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

Redis被配置爲保存數據庫快照,但它目前不能持久化到硬盤。用來修改集合數據的命令不能用。請查看Redis日誌的詳細錯誤信息。

原因:

強制關閉Redis快照導致不能持久化。

解決方案:

運行config set stop-writes-on-bgsave-error no 命令後關閉配置項stop-writes-on-bgsave-error解決該問題。

root@atwl:/usr/local/redis/bin# ./redis-cli
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
127.0.0.1:6379> lpush myColour "red"
(integer) 1



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章