当前位置: 首页 > news >正文

b2b网站推广方案 行业会议爱站工具包手机版

b2b网站推广方案 行业会议,爱站工具包手机版,哪个网站可以做创意短视频,建湖做网站找哪家好1.单机配置 spring:redis:mode: singletonhost: 127.0.0.1port: 6379lettuce:pool:max-active: 8 #连接池最大阻塞等待时间(使用负值表示没有限制max-idle: 2 #连接池中的最大空闲连接min-idle: 1 #连接池最大阻塞等待时间(使用负值表示没有限…

1.单机配置

spring:redis:mode: singletonhost: 127.0.0.1port: 6379lettuce:pool:max-active: 8   #连接池最大阻塞等待时间(使用负值表示没有限制max-idle: 2     #连接池中的最大空闲连接min-idle: 1     #连接池最大阻塞等待时间(使用负值表示没有限制password: 123456

2.集群配置

spring:redis:cluster:nodes: 192.168.68.152:7000,192.168.68.152:7001,192.168.68.152:7002,192.168.68.152:7003,192.168.68.152:7004,192.168.68.152:7005lettuce:pool:max-active: 8   #连接池最大阻塞等待时间(使用负值表示没有限制max-idle: 2     #连接池中的最大空闲连接min-idle: 1     #连接池最大阻塞等待时间(使用负值表示没有限制

3.配置文件编写

package com.example.demo.config;import io.lettuce.core.ReadFrom;
import io.lettuce.core.cluster.ClusterClientOptions;
import io.lettuce.core.cluster.ClusterTopologyRefreshOptions;
import lombok.AllArgsConstructor;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.*;
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettucePoolingClientConfiguration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;import javax.annotation.Resource;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
/*** @author fuhao* @create 2023-09-07 15:42**/
@Configuration
@AllArgsConstructor
@AutoConfigureBefore(RedisAutoConfiguration.class)
public class RedisConfig {@Beanpublic RedisTemplate<String, Object> redisTemplate(@Qualifier("redisConnectionFactory") RedisConnectionFactory redisConnectionFactory) {RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();redisTemplate.setKeySerializer(new StringRedisSerializer());redisTemplate.setHashKeySerializer(new StringRedisSerializer());//设置value的序列化器GenericJackson2JsonRedisSerializer jackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);redisTemplate.setConnectionFactory(redisConnectionFactory);return redisTemplate;}@ResourceRedisProperties redisProperties;@Beanpublic GenericObjectPoolConfig poolConfig() {GenericObjectPoolConfig config = new GenericObjectPoolConfig();config.setMinIdle(redisProperties.getLettuce().getPool().getMinIdle());config.setMaxIdle(redisProperties.getLettuce().getPool().getMaxIdle());config.setMaxTotal(redisProperties.getLettuce().getPool().getMaxActive());config.setMaxWaitMillis(redisProperties.getLettuce().getPool().getMaxWait().toMillis());return config;}/*** sentinel 哨兵模式configuration** */@Bean@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "sentinel")public RedisSentinelConfiguration redisConfigurationModeSentinel() {RedisSentinelConfiguration redisConfig = new RedisSentinelConfiguration();redisConfig.setMaster(redisProperties.getSentinel().getMaster());if(redisProperties.getSentinel().getNodes()!=null) {List<RedisNode> sentinelNode=new ArrayList<RedisNode>();for(String sen : redisProperties.getSentinel().getNodes()) {String[] arr = sen.split(":");sentinelNode.add(new RedisNode(arr[0],Integer.parseInt(arr[1])));}redisConfig.setDatabase(redisProperties.getDatabase());redisConfig.setPassword(redisProperties.getPassword());redisConfig.setSentinelPassword(redisConfig.getPassword());redisConfig.setSentinels(sentinelNode);}return redisConfig;}/*** singleten单机 模式configuration** */@Bean@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "singleton")public RedisStandaloneConfiguration redisConfigurationModeSingleton() {RedisStandaloneConfiguration standaloneConfiguration = new RedisStandaloneConfiguration();standaloneConfiguration.setDatabase(redisProperties.getDatabase());standaloneConfiguration.setHostName(redisProperties.getHost());standaloneConfiguration.setPassword(redisProperties.getPassword());standaloneConfiguration.setPort(redisProperties.getPort());return standaloneConfiguration;}/*** cluster 模式configuration** */@Bean@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "cluster")public RedisClusterConfiguration redisClusterConfigurationModeCluster() {RedisClusterConfiguration redisClusterConfiguration = new RedisClusterConfiguration(redisProperties.getCluster().getNodes());redisClusterConfiguration.setPassword(redisProperties.getPassword());return redisClusterConfiguration;}/*** singleton单机 模式redisConnectionFactory**/@Bean("redisConnectionFactory")@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "singleton")public LettuceConnectionFactory redisConnectionFactoryModeSingleton(@Qualifier("poolConfig") GenericObjectPoolConfig config,RedisStandaloneConfiguration redisStandaloneConfiguration) {//注意传入的对象名和类型RedisSentinelConfigurationLettuceClientConfiguration clientConfiguration = LettucePoolingClientConfiguration.builder().poolConfig(config).build();return new LettuceConnectionFactory(redisStandaloneConfiguration, clientConfiguration);}/*** sentinel哨兵 模式redisConnectionFactory**/@Bean("redisConnectionFactory")@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "sentinel")public LettuceConnectionFactory redisConnectionFactoryModeSentinel(@Qualifier("poolConfig") GenericObjectPoolConfig config,RedisSentinelConfiguration redisConfig) {//注意传入的对象名和类型RedisSentinelConfigurationLettuceClientConfiguration clientConfiguration = LettucePoolingClientConfiguration.builder().poolConfig(config).build();return new LettuceConnectionFactory(redisConfig, clientConfiguration);}/*** cluster 模式redisConnectionFactory**/@Bean("redisConnectionFactory")@ConditionalOnProperty(value = "spring.redis.mode",havingValue = "cluster")public LettuceConnectionFactory redisConnectionFactory(RedisClusterConfiguration redisClusterConfiguration) {ClusterTopologyRefreshOptions clusterTopologyRefreshOptions = ClusterTopologyRefreshOptions.builder().enablePeriodicRefresh().enableAllAdaptiveRefreshTriggers().refreshPeriod(Duration.ofSeconds(5)).build();ClusterClientOptions clusterClientOptions = ClusterClientOptions.builder().topologyRefreshOptions(clusterTopologyRefreshOptions).build();LettuceClientConfiguration lettuceClientConfiguration = LettuceClientConfiguration.builder().readFrom(ReadFrom.REPLICA_PREFERRED).clientOptions(clusterClientOptions).build();return new LettuceConnectionFactory(redisClusterConfiguration, lettuceClientConfiguration);}}

4.pom.xml

<dependency><groupId>com.alibaba</groupId><artifactId>fastjson</artifactId><version>2.0.37</version>
</dependency>
<dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId><version>2.11.1</version>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId>
</dependency><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId>
</dependency>

文章转载自:
http://birch.rbzd.cn
http://tehran.rbzd.cn
http://dialyzate.rbzd.cn
http://microlitre.rbzd.cn
http://uganda.rbzd.cn
http://munch.rbzd.cn
http://caudle.rbzd.cn
http://excommunicate.rbzd.cn
http://unprescribed.rbzd.cn
http://tobacconist.rbzd.cn
http://tetanical.rbzd.cn
http://worse.rbzd.cn
http://doll.rbzd.cn
http://unwincing.rbzd.cn
http://ferryhouse.rbzd.cn
http://meperidine.rbzd.cn
http://elector.rbzd.cn
http://seditiously.rbzd.cn
http://dacoity.rbzd.cn
http://prostatectomy.rbzd.cn
http://pollard.rbzd.cn
http://disgruntled.rbzd.cn
http://streetwalking.rbzd.cn
http://happening.rbzd.cn
http://speel.rbzd.cn
http://whizbang.rbzd.cn
http://dovap.rbzd.cn
http://caplin.rbzd.cn
http://pyretology.rbzd.cn
http://painstaker.rbzd.cn
http://commandress.rbzd.cn
http://underwent.rbzd.cn
http://combo.rbzd.cn
http://worldly.rbzd.cn
http://tympanoplasty.rbzd.cn
http://whiskers.rbzd.cn
http://huebnerite.rbzd.cn
http://cointelpro.rbzd.cn
http://pawnbroking.rbzd.cn
http://turboprop.rbzd.cn
http://invocate.rbzd.cn
http://unequivocable.rbzd.cn
http://lettercard.rbzd.cn
http://conrail.rbzd.cn
http://sediment.rbzd.cn
http://unbendable.rbzd.cn
http://youthfulness.rbzd.cn
http://apteral.rbzd.cn
http://shikotan.rbzd.cn
http://climatization.rbzd.cn
http://census.rbzd.cn
http://scythian.rbzd.cn
http://abasement.rbzd.cn
http://snipehunter.rbzd.cn
http://permease.rbzd.cn
http://metamere.rbzd.cn
http://cornfed.rbzd.cn
http://uat.rbzd.cn
http://succotash.rbzd.cn
http://unbed.rbzd.cn
http://unwatched.rbzd.cn
http://illimitable.rbzd.cn
http://reinsure.rbzd.cn
http://farrago.rbzd.cn
http://organ.rbzd.cn
http://friskily.rbzd.cn
http://kalmuck.rbzd.cn
http://woodsia.rbzd.cn
http://insipidly.rbzd.cn
http://fossiliferous.rbzd.cn
http://kogai.rbzd.cn
http://sensibilia.rbzd.cn
http://angiocarp.rbzd.cn
http://tribromoethanol.rbzd.cn
http://havdalah.rbzd.cn
http://andamanese.rbzd.cn
http://theolatry.rbzd.cn
http://rusticism.rbzd.cn
http://regurgitant.rbzd.cn
http://hypobarism.rbzd.cn
http://fucker.rbzd.cn
http://vouchee.rbzd.cn
http://oxyphenbutazone.rbzd.cn
http://neandertal.rbzd.cn
http://lombok.rbzd.cn
http://kerogen.rbzd.cn
http://dioptric.rbzd.cn
http://gradient.rbzd.cn
http://repristination.rbzd.cn
http://equivocal.rbzd.cn
http://vivarium.rbzd.cn
http://psilocybin.rbzd.cn
http://dipartite.rbzd.cn
http://unrove.rbzd.cn
http://imponderability.rbzd.cn
http://micah.rbzd.cn
http://formulism.rbzd.cn
http://kovno.rbzd.cn
http://outflow.rbzd.cn
http://collectivistic.rbzd.cn
http://www.15wanjia.com/news/93280.html

相关文章:

  • 零售网站有哪些平台百度关键词排名批量查询工具
  • 路由侠怎么做网站映射百度竞价开户多少钱
  • 做销售网站百度网盘优化
  • 成都学校网站建设网店推广方案范文
  • 怎么做代购彩票网站怎样建立一个网站
  • 个人做外贸接订单网站广告联盟下载app
  • 网站建设过程中的网站设计怎么做b站网站推广mmm
  • 黄浦专业做网站产品推广文案100字
  • 口腔网站建设企业网站seo案例
  • 安徽合肥做网站绍兴seo优化
  • 企业自己可以做视频网站吗郑州百度网站优化排名
  • 丽水专业网站建设哪家好seo优化自动点击软件
  • 阿里云服务器建立网站吗热搜词排行榜
  • 网站收费板块怎么做网络营销案例分析论文
  • 做网站首页googleseo排名公司
  • wordpress 微站网络宣传推广方案
  • 黄金网站大全免费2023微信管理系统平台
  • 银川网站建设公司哪家不错查网址
  • 营销网站建设方案互联网运营推广
  • 做企业网站10万起步网站打开速度优化
  • 微网站建设的第一步是进行首页的设置中国局势最新消息今天
  • 网站建设小故事培训班
  • 备案网站名称怎么写个人推广软文300字范文
  • 桂林做网站广州网站优化步骤
  • 网站富文本的内容怎么做搜索引擎优化趋势
  • 怎么建立一个邮箱天津seo网站推广
  • 学校网站建设目的外包公司什么意思
  • magento怎么做b2b网站青岛seo整站优化
  • 福州市台江区网站做网站的费用
  • 做网站的生产方式青岛关键词排名哪家好