码迷,mamicode.com
首页 > 其他好文 > 详细

redis集群

时间:2014-09-01 15:27:33      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   os   io   ar   div   cti   log   

 

 

<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集群

标签:style   blog   color   os   io   ar   div   cti   log   

原文地址:http://www.cnblogs.com/empireghost/p/3949243.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!