连接Redis异常:JedisMovedDataException
2017-11-07 15:02
381 查看
连接Redis异常:JedisMovedDataException
转载请注明出处
环境
java API连接redis出现下面的异常信息:
redis.clients.jedis.exceptions.JedisMovedDataException: MOVED 1539 172.31.59.103:6379
解决方案
将连接对象从 Jedis 换成 JedisCluster。就可以了。问题原因
MOVED表示使用的是Redis群集。而 Jedis 不是集群模式。code
//import redis.clients.jedis.HostAndPort; //import redis.clients.jedis.JedisCluster; HostAndPort hostAndPort = new HostAndPort(host, port); Set<HostAndPort> hostAndPortSet = new HashSet<>(); hostAndPortSet.add(hostAndPort); JedisCluster jedis = new JedisCluster(hostAndPortSet); jedis.setnx(key, value);
相关文章推荐
- redis存储tomcat共享session异常:redis.clients.jedis.exceptions.JedisDataException: NOAUTH Authentication
- redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
- redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
- redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
- spring-data-redis用配置类连接时,抛异常Cannot get Jedis connection; nested exception is java.lang.NullPointerE
- 客户端连接redis出现:redis.clients.jedis.exceptions.JedisDataException: DENIED Redis is running
- spring-data-redis用配置类连接时,抛异常Cannot get Jedis connection; nested exception is java.lang.NullPointerEx
- redis.clients.jedis.exceptions.JedisDataException: MOVED 13102 127.0.0.1
- redis异常解决:jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
- [redis] redis.clients.jedis.exceptions.JedisDataException: MOVED 13102 127.0.0.1
- wind 4000 ows连接linux中的redis连不上报JedisDataException
- jedis连接redis提示JedisConnectionException
- redis3.0 redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holdin
- redis.clients.jedis.exceptions.JedisDataException: ERR Operation against a key holding the wrong kin
- redis.clients.jedis.exceptions.JedisDataException: ERR unknown command 'PSETEX'
- Java通过Jedis连接Redis异常,错误记录
- 【redis】常见JedisConnectionException异常分析
- redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no password is set
- redis.clients.jedis.exceptions.JedisDataException: ERR Protocol error: invalid bulk length
- redis.clients.jedis.exceptions.JedisDataException: WRONGTYPE Operation against a key holding the wrong kind of value