parent
cde377881e
commit
ac87ae0232
@ -0,0 +1,40 @@ |
|||||||
|
//package com.dxhy.order.invoice.config;
|
||||||
|
//
|
||||||
|
//import org.apache.commons.lang3.StringUtils;
|
||||||
|
//import org.redisson.Redisson;
|
||||||
|
//import org.redisson.api.RedissonClient;
|
||||||
|
//import org.redisson.config.Config;
|
||||||
|
//import org.redisson.config.ReadMode;
|
||||||
|
//import org.redisson.config.SentinelServersConfig;
|
||||||
|
//import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
|
||||||
|
//import org.springframework.context.annotation.Bean;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
//public class RedissonConfig {
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// private RedisProperties redisProperties;
|
||||||
|
//
|
||||||
|
// //哨兵模式配置
|
||||||
|
// @Bean
|
||||||
|
// RedissonClient redissonSentinel() {
|
||||||
|
// Config config = new Config();
|
||||||
|
// RedisProperties.Sentinel sentinel = redisProperties.getSentinel();
|
||||||
|
// List<String> newNodes = sentinel.getNodes();
|
||||||
|
// newNodes.stream().forEach((index) -> newNodes.add(
|
||||||
|
// index.startsWith("redis://") ? index : "redis://" + index));
|
||||||
|
//
|
||||||
|
// SentinelServersConfig serverConfig = config.useSentinelServers()
|
||||||
|
// .addSentinelAddress(newNodes.toArray(new String[0]))
|
||||||
|
// .setMasterName(sentinel.getMaster())
|
||||||
|
// .setReadMode(ReadMode.SLAVE);
|
||||||
|
//
|
||||||
|
// if (StringUtils.isNotBlank(redisProperties.getPassword())) {
|
||||||
|
// serverConfig.setPassword(redisProperties.getPassword());
|
||||||
|
// }
|
||||||
|
// return Redisson.create(config);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//}
|
Loading…
Reference in new issue