首页>>帮助中心>>vps服务器中linux使用Redis连接时出现报错

vps服务器中linux使用Redis连接时出现报错

2023/5/5 1472次
问题一:
-DENIED Redis is running in protected modebecause protected mode is enabled, no bind address was specified, noauthentication password is
requested to clients

解决:

redis-cli -p 6688
127.0.0.1:6688 >
//改redis守护进程成no ,不在启用
127.0.0.1:6688 > config set daemonize “no”
OK
//改redis保护模式成no,不在启用
127.0.0.1:6688 > config set protected-mode “no”
OK

或者是进入redis.conf中对配置文件进行修改
(切记使用./redis-server /usr/local/redis-4.0.6/redis.conf启动 否则不会生效)

问题二:
MISCONF Redis is configured to save RDB snapshots, but it is currently
not able to persist on disk

原因是因为强制把redis快照关闭了导致不能持久化

解决:
127.0.0.1:6688> config set stop-writes-on-bgsave-error no

或者

修改redis.conf配置文件:vi打开redus-server配置文件中的redis.conf文件,
使用快捷匹配模式定位到stop-writes-on-bgsave-error 所在位置,把yes改为no即可

问题三:
redis ERR invalid DB index

解决:
修改redis.windows.conf配置文件即可

#Set the number of databases. The default database is DB 0, you can
#select a different one on a per-connection basis using SELECT
#where dbid is a number between 0 and ‘databases’-1
#我这里修改为40了
databases 40