Skip to content

Instantly share code, notes, and snippets.

@yangl
Last active April 16, 2018 10:58
Show Gist options
  • Save yangl/a0cabe55c8bae8d9ad0fdf10ae17aec4 to your computer and use it in GitHub Desktop.
Save yangl/a0cabe55c8bae8d9ad0fdf10ae17aec4 to your computer and use it in GitHub Desktop.
spring-data-redis + lettuce 配置
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/beans" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="sentinelConfiguration" class="org.springframework.data.redis.connection.RedisSentinelConfiguration">
<property name="sentinels">
<set>
<bean name="sentinelNode1" class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="10.203.63.41"/>
<constructor-arg name="port" value="8001"/>
</bean>
<bean name="sentinelNode2" class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="10.203.63.42"/>
<constructor-arg name="port" value="8001"/>
</bean>
<bean name="sentinelNode3" class="org.springframework.data.redis.connection.RedisNode">
<constructor-arg name="host" value="10.203.63.43"/>
<constructor-arg name="port" value="8001"/>
</bean>
</set>
</property>
<property name="master">
<bean class="org.springframework.data.redis.connection.RedisNode" p:name="ITAO_UEP_CORE_REDIS_ENGINE_C01"/>
</property>
<property name="password">
<bean class="org.springframework.data.redis.connection.RedisPassword">
<constructor-arg name="thePassword" value="7aiawgmhyki7hyac"/>
</bean>
</property>
</bean>
<bean id="lettuceConnectionFactory"
class="org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory">
<constructor-arg name="sentinelConfiguration" ref="sentinelConfiguration"/>
</bean>
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate"
p:connection-factory-ref="lettuceConnectionFactory"/>
</beans>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment