zoukankan      html  css  js  c++  java
  • redis 集群

    集群环境搭建:

    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>
  • 相关阅读:
    常见的无损压缩算法
    多媒体基本概念
    电子商务
    Java正则表达式
    Java 注解
    java泛型
    Java的反射机制
    Java 动态代理
    函数调用约定_stdcall[转]
    要研究的东东啊
  • 原文地址:https://www.cnblogs.com/xlh91118/p/6567345.html
Copyright © 2011-2022 走看看