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

redis 集群

时间:2017-03-17 17:52:54      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:schema   connect   article   ace   ref   http   .com   xsd   name   

集群环境搭建:

http://www.cnblogs.com/hjwublog/p/5681700.html

http://lib.csdn.net/article/16/45369?knId=407

<?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:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
       xmlns:util="http://www.springframework.org/schema/util"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">

    <!--引入配置属性文件 -->
    <context:property-placeholder location="classpath:redis.properties" />

    <!--<bean id="redisClusterConfiguration" class="com.laowang.util.RedisClusterConfigurationFactoryBean">-->
        <!--<property name="nodes" value="${redis.nodes}"/>-->
        <!--<property name="maxRedirects" value="${redis.maxRedirects}"/>-->
    <!--</bean>-->


    <bean id="redisNode1" class="org.springframework.data.redis.connection.RedisNode">
        <constructor-arg index="0" value="192.168.163.128"/>
        <constructor-arg index="1" value="7031"/>
    </bean>
    <!--<bean id="redisNode2" class="org.springframework.data.redis.connection.RedisNode">-->
        <!--<constructor-arg index="0" value="192.168.163.128"/>-->
        <!--<constructor-arg index="1" value="7032"/>-->
    <!--</bean>-->


    <bean id="redisClusterConfiguration" class="org.springframework.data.redis.connection.RedisClusterConfiguration">
        <property name="clusterNodes">
            <set>
                <ref bean="redisNode1"/>
                <!--<ref bean="redisNode2"/>-->
            </set>
        </property>
        <property name="maxRedirects" value="30"/>
    </bean>

    <bean id="jedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory" p:usePool="true">
        <constructor-arg ref="redisClusterConfiguration"/>
    </bean>

    <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate" p:connectionFactory-ref="jedisConnectionFactory"/>
</beans>

 

redis 集群

标签:schema   connect   article   ace   ref   http   .com   xsd   name   

原文地址:http://www.cnblogs.com/xlh91118/p/6567345.html

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