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>
  • 相关阅读:
    EF架构~Dapper.Contrib不能将Linq翻译好发到数据库,所以请不要用它
    docker~aspnetcore2.0镜像缺少libgdiplus问题
    DotNetCore跨平台~Quartz定时单次任务
    Java学习笔记——JDBC之与数据库MySQL的连接以及增删改查等操作
    可爱的玩笑
    树蛙和摄影师
    axis WebServices 完美调用天气预报,查询、显示 代码!
    跟随一生的帐号密码
    [置顶] VB6基本数据库应用(三):连接数据库与SQL语句的Select语句初步
    Citrix 服务器虚拟化之九 Xenserver虚拟机的XenMotion
  • 原文地址:https://www.cnblogs.com/xlh91118/p/6567345.html
Copyright © 2011-2022 走看看