【问题标题】:Is transaction (multi, exec) supported in spring data redis in a cluster mode?spring data redis在集群模式下是否支持事务(multi,exec)?
【发布时间】:2017-03-30 17:05:19
【问题描述】:

我已经成功地在单个 REDIS 实例中使用 multi 和 exec 功能在 redis 中实现(并测试了)事务操作。但是,在集群设置中运行的相同代码会出错,并显示以下异常消息。我正在使用 spring-data-redis-1.8.1.RELEASE 和 jedis-2.9.0。

Exception in thread "main" org.springframework.dao.InvalidDataAccessApiUsageException: MUTLI is currently not supported in cluster mode.
    at org.springframework.data.redis.connection.jedis.JedisClusterConnection.multi(JedisClusterConnection.java:2457)
    at org.springframework.data.redis.connection.DefaultStringRedisConnection.multi(DefaultStringRedisConnection.java:608)
    at org.springframework.data.redis.core.RedisTemplate$21.doInRedis(RedisTemplate.java:871)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:207)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:169)
    at org.springframework.data.redis.core.RedisTemplate.multi(RedisTemplate.java:868)
    at com.glu.centech.chat.RedisClusterTest$1.execute(RedisClusterTest.java:58)
    at com.glu.centech.chat.RedisClusterTest$1.execute(RedisClusterTest.java:1)
    at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:229)
    at com.glu.centech.chat.RedisClusterTest.main(RedisClusterTest.java:55)

目前spring data redis集群模式是否支持事务(multi, exec)?如果是这样,我错过了什么?如果没有,是否有任何解决方法或何时支持?

【问题讨论】:

    标签: transactions redis cluster-computing jedis spring-data-redis


    【解决方案1】:

    使用 Spring Data Redis 的 Redis Cluster 没有事务支持,您不应该期望它会被实现。如需进一步参考,请参阅Is there any Redis client (Java prefered) which supports transactions on Redis cluster?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-06
      • 2015-06-18
      • 2015-08-26
      • 2015-08-17
      • 2018-10-15
      • 2018-06-20
      • 2021-03-09
      • 2012-06-24
      相关资源
      最近更新 更多