问题:
Unable to connect to Redis; nested exception is io.lettuce.core.RedisCommandTimeoutException: Command timed out after no timeout
**错误原因:**连接超时时间设置的过于短暂(我这边设置成了0),修改为5000左右即可
解决方法:
#连接超时时间(毫秒)
spring.redis.timeout=5000
问题:
org.springframework.data.redis.RedisConnectionFailureException
解决方法:
修改redis配置文件redis.conf
关闭redis的保护模式 : protected-model no
注释掉绑定的默认ip bind 127.0.0.1 添加bind 0.0.0.0
关闭防火墙 systemctl stop firewall
启动redis 服务端:
./redis-server ../redis.conf
nohup ./redis-server ../redis.conf &
tail - f nohup.out
启动redis客户端:
./redis-cli
Redis数据类型
STRING:字符串、整数或浮点数
LIST:列表,可存储多个相同的字符串
SET:集合,存储不同元素,无序排列
HASH:散列表,存储键值对之间的映射,无序排列
ZSET:有序集合,存储键值对,有序排列