在学习list相关命令的时候,lpush某个值后产生不能持久化的错误
127.0.0.1:6379> lpush runoob redis
1
127.0.0.1:6379> lpush runoob mongodb
2
127.0.0.1:6379> lpush runoob rabbitmq
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.
错误如下:
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.
解决方法:
需要修改配置文件内的属性 stop-writes-on-bgsave-error,值设置为no
详细解释见:https://blog.csdn.net/qq_43178138/article/details/119144986
直接在命令行里修改,或者退出命令行,修改redis.conf,然后重启redis服务
这里直接在命令行里修改:
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK
接下来lpush多少个都没问题了
127.0.0.1:6379> lrange runoob 0 10
mongodb
redis
127.0.0.1:6379> lpush runoob rabbitmq
3
127.0.0.1:6379> lpush runoob redis
4
127.0.0.1:6379> lpush runoob mysql
5
127.0.0.1:6379> lrange runoob 0 10
mysql
redis
rabbitmq
mongodb
redis
要注意显示list时,最下面的是list[0]