Redis安装配置记录

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/giianhui/article/details/52098847

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



猜你喜欢

转载自blog.csdn.net/giianhui/article/details/52098847