问题
我想在服务器上部署springboot项目,但是连不到redis。
原因
Redis服务器正在运行在保护模式下,并且没有为默认用户设置密码。在保护模式下,Redis只接受来自本地回环接口(loopback interface)的连接。
解决方案:禁用保护模式。
- 找到Redis配置文件(通常位于/etc/redis/redis.conf)。
- 将Redis配置为监听所有网络接口.
# bind 127.0.0.1
bind 0.0.0.0
找到protected-mode选项并将其设置为no。
protected-mode no
- 重启Redis服务器
sudo systemctl restart redis-server