操作系统:windows 7 旗舰版 64 位操作系统
redis版本:Redis-x64-3.0.500.msi
项目启动异常:
1.redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
2.redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
异常出现原因分析:
redis不做配置正常启动,默认无密码,若是程序中连接池的设置是有密码的就会出现以上错误
解决办法:规范配置(设置密码使连接池和redis配置中的密码保持一致)
1.在控制台进行密码设置,该设置在关闭redis后失效,每次重新登录后,需再次设置。
redis 127.0.0.1:6379>CONFIG SET requirepass "root"
OK
redis 127.0.0.1:6379>AUTH "root"
OK
2.在redis.windows-service.conf中进行设置 requirepass = 你的密码 重启后永久生效(由于redis版本不同,配置文件.conf的文件名不同,需要找到对应版本的配置文件)
如此:使配置密码 和 登陆授权密码 一致,即可解决问题