本文整理汇总了Java中org.springframework.data.redis.connection.RedisSentinelConfiguration类的典型用法代码示例。如果您正苦于以下问题:Java RedisSentinelConfiguration类的具体用法?Java RedisSentinelConfiguration怎么用?Java RedisSentinelConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RedisSentinelConfiguration类属于org.springframework.data.redis.connection包,在下文中一共展示了RedisSentinelConfiguration类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected final RedisSentinelConfiguration getSentinelConfig() {
if (StringUtils.hasText(sentinelNodes)) {
RedisSentinelConfiguration config = new RedisSentinelConfiguration();
config.master(sentinelMaster);
config.setSentinels(createSentinels());
return config;
}
return null;
}
示例2: sentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
* redis哨兵配置
* @return
*/
@Bean
public RedisSentinelConfiguration sentinelConfig(){
if(this.clusterSentinels.size()<=0 ||
this.clusterSentinels.get(0).length()==0){
return null;
}
return new RedisSentinelConfiguration(this.clusterMaster,
new HashSet<>(this.clusterSentinels));
}
示例3: sentinelConnectionFactory
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
*redis 主从
* @return
*/
@Bean(name="sentinelConnectionFactory")
public RedisConnectionFactory sentinelConnectionFactory(
JedisPoolConfig poolConfig,
RedisSentinelConfiguration sentinelConfig){
if(sentinelConfig!=null){
JedisConnectionFactory jcf=new JedisConnectionFactory(sentinelConfig,poolConfig);
jcf.setHostName(this.host);
jcf.setPort(this.port);
jcf.setTimeout(timeout);
// jcf.setPassword(this.password);
return jcf;
}
return connectionFactory(poolConfig);
}
示例4: test
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
@org.junit.Test
public void test(){
String user_prefix="user_";
User user=new User(1,"aric");
ApplicationContext atc=new AnnotationConfigApplicationContext(RedisStartConfig.class);
RedisTemplate<String,User> obj = (RedisTemplate) atc.getBean("redisTemplate");
PrinterUtils.printILog(obj.getKeySerializer());
obj.opsForValue().set(user_prefix+user.getId(),user);
RedisSentinelConfiguration RedisSentinelConfiguration = (RedisSentinelConfiguration) atc.getBean("sentinelConfig");
PrinterUtils.printILog(RedisSentinelConfiguration);
User value=obj.opsForValue().get(user_prefix+1);
PrinterUtils.printELog(value.getUsername());
}
示例5: RedisConnectionConfiguration
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public RedisConnectionConfiguration(RedisProperties properties,
ObjectProvider<RedisSentinelConfiguration> sentinelConfigurationProvider,
ObjectProvider<RedisClusterConfiguration> clusterConfigurationProvider) {
this.properties = properties;
this.sentinelConfiguration = sentinelConfigurationProvider.getIfAvailable();
this.clusterConfiguration = clusterConfigurationProvider.getIfAvailable();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:RedisAutoConfiguration.java
示例6: getSentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected final RedisSentinelConfiguration getSentinelConfig() {
if (this.sentinelConfiguration != null) {
return this.sentinelConfiguration;
}
Sentinel sentinelProperties = this.properties.getSentinel();
if (sentinelProperties != null) {
RedisSentinelConfiguration config = new RedisSentinelConfiguration();
config.master(sentinelProperties.getMaster());
config.setSentinels(createSentinels(sentinelProperties));
return config;
}
return null;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:RedisAutoConfiguration.java
示例7: jedisConnectionFactory
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
@Bean
public JedisConnectionFactory jedisConnectionFactory(){
RedisSentinelConfiguration sentinelConfig = new RedisSentinelConfiguration()
.master("mymaster")
.sentinel("127.0.0.1", 26379)
.sentinel("127.0.0.1", 26380);
return new JedisConnectionFactory(sentinelConfig);
}
示例8: RequiresRedisSentinel
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
protected RequiresRedisSentinel(RedisSentinelConfiguration config) {
this.sentinelConfig = config;
}
示例9: sentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public @Bean RedisSentinelConfiguration sentinelConfig() {
return SENTINEL_CONFIG;
}
示例10: HwRedisConnectionFactory
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public HwRedisConnectionFactory(RedisSentinelConfiguration sentinelConfig, JedisPoolConfig poolConfig) {
this.sentinelConfig = sentinelConfig;
this.poolConfig = poolConfig != null ? poolConfig : new JedisPoolConfig();
}
示例11: getSentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public RedisSentinelConfiguration getSentinelConfig() {
return sentinelConfig;
}
示例12: setSentinelConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
public void setSentinelConfig(RedisSentinelConfiguration sentinelConfig) {
this.sentinelConfig = sentinelConfig;
}
示例13: forConfig
import org.springframework.data.redis.connection.RedisSentinelConfiguration; //导入依赖的package包/类
/**
* Create new {@link RedisSentinelRule} for given {@link RedisSentinelConfiguration}.
*
* @param config
* @return
*/
public static RequiresRedisSentinel forConfig(RedisSentinelConfiguration config) {
return new RequiresRedisSentinel(config != null ? config : DEFAULT_SENTINEL_CONFIG);
}