远程连接redis数据库问题
1.错误: Could not get a resource from the pool
问题描述:本地maven远程连接redis数据库,报出:
Caused by: redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool
2.解决方法
查了一下,排除防火墙的问题后,原因是redis默认是不支持远程连接的,在redis的配置文件redis.conf中做出如下修改:
1.注释仅本地回环限制
#bind 127.0.0.1
2.因为redis本身处于保护模式,所以有两种方式:关闭保护模式;开启密码保护。这里选择第一种,修改配置文件中的将protected-mode yes修改为protected-mode no
3.使用包含配置文件的方式启动redis
./redis-server . ./redis.conf