1

I am trying to connect multiple redis instances via spring. But I did not find any documentation.

Here is how I am using it currently. I am using Jedis as the client and I plan on using Jedis only as I might require support for sentinel.

<bean id="jedisConnFactory"
    class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory">
    <property name ="hostName" value ="localhost"/>
    <property name="port" value="6379" />   
</bean>

<bean id="stringRedisSerializer"
    class="org.springframework.data.redis.serializer.StringRedisSerializer" />

<!-- redis template definition -->
<bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate"
    p:connection-factory-ref="jedisConnFactory" 
    p:keySerializer-ref="stringRedisSerializer"
    p:hashKeySerializer-ref="stringRedisSerializer"
    p:ValueSerializer-ref="stringRedisSerializer" />

I want to add multiple redis instances to the connection pool. Like..

<property name ="hosts" value ="localhost:6379,localhost:6380"/>
Krishan Subudhi
  • 376
  • 3
  • 18

2 Answers2

1

After researching , I found, there is no support for client side partitioning currently in spring-data-redis.

In future the partitioning technique in redis shall move to redis-cluster permanently.

At present, To use partition along with spring-data-redis, the best way is to use twemproxy and point JedisConnectionFactory host and port to twemproxy.

Krishan Subudhi
  • 376
  • 3
  • 18
0

In case you're looking for support of JedisSentinelPool then have a look at does-spring-data-redis-1-3-2-release-support-jedissentinelpool-of-jedis.

Community
  • 1
  • 1
Christoph Strobl
  • 6,491
  • 25
  • 33
  • Yes spring redis supports sentinel. But currently only Jedis supports Redis Sentinel. Hence I want to use Jedis as the underlying library. But that's now that I am asking for. – Krishan Subudhi Oct 17 '14 at 08:05