简单整理一下,在启动修改redis配置文件中遇到的坑。
目前项目使用的是spring-cloud Hoxton.SR10版本。由于需要上生产环境,对redis的危险命令进行禁用和重命名,配置如下:
rename-command KEYS “” // 必禁命令
rename-command FLUSHALL “” // 必禁命令,谁会清除数据呢
rename-command FLUSHDB “” // 必禁命令,谁会清除数据呢
rename-command CONFIG “CONFIG_JHG7654SGSHA” // 重命名
启动服务的过程中报错如下:
Caused by: org.springframework.data.redis.connection.ClusterCommandExecutionFailureException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command CONFIG
, with args beginning with: GET
, notify-keyspace-events
, ; nested exception is org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: ERR unknown command CONFIG
, with args beginning with: GET
, notify-keyspace-events
,
报错原因是rename-command CONFIG,config的问题。注释掉就好了。至于代码怎么调整还有待研究