采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
请教老师 例如要使用redis 哨兵 ,xml里配置就可以了吗?
可以的,参考:
<!-- 哨兵配置 --> <bean id="sentinelConfig" class="org.springframework.data.redis.connection.RedisSentinelConfiguration"> <!-- 服务名称 --> <property name="master"> <bean class="org.springframework.data.redis.connection.RedisNode"> <property name="name" value="mymaster"/> </bean> </property> <!-- 哨兵服务IP与端口 --> <property name="sentinels"> <set> <!-- 哨兵1 --> <bean class="org.springframework.data.redis.connection.RedisNode"> <constructor-arg name="host" value="192.168.0.123"/> <constructor-arg name="port" value="23967"/> </bean> <!-- 哨兵2 --> <bean class="org.springframework.data.redis.connection.RedisNode"> <constructor-arg name="host" value="192.168.0.124"/> <constructor-arg name="port" value="23967"/> </bean> <!-- 哨兵3 --> <bean class="org.springframework.data.redis.connection.RedisNode"> <constructor-arg name="host" value="192.168.0.125"/> <constructor-arg name="port" value="23967"/> </bean> </set> </property> </bean>
登录后可查看更多问答,登录/注册
以项目整合Redis各种场景,从此轻松应对各类Redis难题
1.4k 11
2.4k 9
1.2k 8
860 7
1.1k 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号