Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only slave.

 

Caused by: redis.clients.jedis.exceptions.JedisDataException: READONLY You can't write against a read only slave.
    at redis.clients.jedis.Protocol.processError(Protocol.java:127) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.Protocol.process(Protocol.java:161) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.Protocol.read(Protocol.java:215) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:340) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.Connection.getStatusCodeReply(Connection.java:239) ~[jedis-2.9.0.jar:na]
    at redis.clients.jedis.BinaryJedis.setex(BinaryJedis.java:616) ~[jedis-2.9.0.jar:na]
    at org.springframework.data.redis.connection.jedis.JedisConnection.setEx(JedisConnection.java:1418) ~[spring-data-redis-1.8.4.RELEASE.jar:na]
    ... 73 common frames omitted

 

这是因为连接的是从节点,从节点只有读的权限,没有写的权限

 

解决办法:

进入redis的redis.conf配置文件,修改配置文件的slave-read-only为no

posted @ 2021-01-11 14:07  yvioo  阅读(2394)  评论(0编辑  收藏  举报