如下:
java
<bean id="connectionFactory"
class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"> -->
<constructor-arg name="clusterConfig"
ref="clusterConfig" />
<constructor-arg name="poolConfig"
ref="jedisPoolConfig" />
<property name="password" value="MTIzNDU2"></property>
</bean>
<!-- 集群配置 -->
<bean id="clusterConfig"
class="org.springframework.data.redis.connection.RedisClusterConfiguration">
<property name="maxRedirects" value="3"></property>
<!-- 集群服务IP与端口 -->
<property name="clusterNodes">
<set>
<!-- server1 -->
<bean
class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="127.0.0.1" />
<constructor-arg name="port" value="6379" />
</bean>
<!-- server2 -->
<bean
class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="127.0.0.1" />
<constructor-arg name="port" value="6380" />
</bean>
<!-- server3 -->
<bean
class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="127.0.0.1" />
<constructor-arg name="port" value="6381" />
</bean>
</set>
</property>
</bean>