首页 > 代码库 > redis集群

redis集群

 

 

<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">        <property name="maxActive"     value="${redis.pool.maxActive}" />        <property name="maxIdle"       value="${redis.pool.maxIdle}" />        <property name="maxWait"       value="${redis.pool.maxWait}" />        <property name="testOnBorrow"  value="${redis.pool.testOnBorrow}" />    </bean>    <!-- jedis 多个服务器配置-->  <bean id="jedisShardInfo1" class="redis.clients.jedis.JedisShardInfo">        <constructor-arg index="0" value="${redis2.ip}" />        <constructor-arg index="1" value="${redis.port}" type="int" />    </bean>       <bean id="jedisShardInfo2" class="redis.clients.jedis.JedisShardInfo">        <constructor-arg index="0" value="${redis.ip}" />        <constructor-arg index="1" value="${redis.port}" type="int" />    </bean>       <bean id="shardedJedisPool" class="redis.clients.jedis.ShardedJedisPool">        <constructor-arg index="0" ref="jedisPoolConfig" />        <constructor-arg index="1">          <list>              <ref bean="jedisShardInfo1" />              <ref bean="jedisShardInfo2"/>          </list>      </constructor-arg>    </bean>    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"      >      <property name="hostName"   value="${redis.ip}" />        <property name="port"       value="${redis.port}" />        <property name="poolConfig" ref="jedisPoolConfig" />         <!--<property name="shardInfo"  ref="shardedJedisPool"></property>-->  </bean>  

 

redis集群