nested exception is redis.clients.jedis.exceptions.JedisMovedDataException: MOVED 16225 XXX:6379

单机模式转化为集群模式错误,需要修改配置,我是直接修改的xml配置文件

<?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans" 
 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xmlns:cache="http://www.springframework.org/schema/cache"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:c="http://www.springframework.org/schema/c"
	xmlns:context="http://www.springframework.org/schema/context"  
  	xsi:schemaLocation="http://www.springframework.org/schema/beans 
   	http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/cache 
    http://www.springframework.org/schema/cache/spring-cache.xsd
    http://www.springframework.org/schema/context 
    http://www.springframework.org/schema/context/spring-context.xsd">   
      
	<!-- spring缓存配置 modify by zhaoyunhua 20170302 -->
	
	<!-- spring缓存机制 -->
	<cache:annotation-driven />   
 
    <!-- 使用redis缓存 -->
    <bean id="cacheManager" class="org.springframework.data.redis.cache.RedisCacheManager" c:_0-ref="redisTemplate"/>
    
    <!-- redis 相关配置 -->  
    <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">  
        <property name="maxIdle" value="1" />
        <property name="maxTotal" value="5" />
        <property name="blockWhenExhausted" value="true" />
        <property name="maxWaitMillis" value="30000" />
        <property name="testOnBorrow" value="true" />
    </bean> 
        
    <bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"  >
       <constructor-arg index="0">
            

            <!-- RedisClusterConfiguration, -->
            <bean class="org.springframework.data.redis.connection.RedisClusterConfiguration">
                <constructor-arg>
                    <list>
                        <value>XXX.XXX.XXX.111:6379</value>
                        <value>XXX.XXX.XXX.112:6379</value>
                        <value>XXX.XXX.XXX.113:6379</value>
                    </list>
                </constructor-arg>
                <property name="maxRedirects" value="5" />
            </bean>
            
            
        </constructor-arg>
        <constructor-arg index="1">
            <bean class="redis.clients.jedis.JedisPoolConfig">
                 <property name="maxTotal" value="100"/>
                 <property name="maxIdle" value="300"/>
                 <property name="minIdle" value="1"/>
                 <property name="maxWaitMillis" value="30000"/>
            </bean>
        </constructor-arg>
    </bean>
      
    <bean id="redisTemplate" class="org.springframework.data.redis.core.RedisTemplate">  
      	<property name="connectionFactory" ref="connectionFactory" />  
    </bean>

</beans>

 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值