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"/>
4

2 に答える 2

1

調査した結果、現在 spring-data-redis ではクライアント側のパーティショニングがサポートされていないことがわかりました。

将来、redis のパーティショニング技術は、永続的に redis-cluster に移行する予定です。

現在、パーティションを spring-data-redis と一緒に使用するには、temproxy を使用し、JedisConnectionFactory ホストとポートを temproxy にポイントするのが最善の方法です。

于 2014-11-03T06:46:46.583 に答える