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

广州网站建设商武汉搜索引擎营销

广州网站建设商,武汉搜索引擎营销,百度竞价排名怎么靠前,wordpress小程序导航收录七技师文章目录 常见报错1. 配置方式使用错误2. 版本差异报错3. 配置文件中配置了密码或者配置错误4. 字符集和序列化方式配置问题5. Redisson的序列化问题6. 连接池问题:7. Redisson的高可用性问题:8. Redisson的并发问题9. Redisson的性能问题 2. 参考文档 常…

文章目录

  • 常见报错
    • 1. 配置方式使用错误
    • 2. 版本差异报错
    • 3. 配置文件中配置了密码或者配置错误
    • 4. 字符集和序列化方式配置问题
    • 5. Redisson的序列化问题
    • 6. 连接池问题:
    • 7. Redisson的高可用性问题:
    • 8. Redisson的并发问题
    • 9. Redisson的性能问题
  • 2. 参考文档

在这里插入图片描述

常见报错

1. 配置方式使用错误

Redisson 提供两种配置方式
1. 第一种使用配置json文件 在application.properties 中使用 spring.redis.redisson.file=classpath:redisson.json
2. 第二种spring.redis.redisson.config=里使用yaml格式如下

spring:redis:redisson: config: |clusterServersConfig:idleConnectionTimeout: 10000connectTimeout: 10000timeout: 3000retryAttempts: 3retryInterval: 1500failedSlaveReconnectionInterval: 3000failedSlaveCheckInterval: 60000password: nullsubscriptionsPerConnection: 5clientName: nullloadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}subscriptionConnectionMinimumIdleSize: 1subscriptionConnectionPoolSize: 50slaveConnectionMinimumIdleSize: 24slaveConnectionPoolSize: 64masterConnectionMinimumIdleSize: 24masterConnectionPoolSize: 64readMode: "SLAVE"subscriptionMode: "SLAVE"nodeAddresses:- "redis://127.0.0.1:7004"- "redis://127.0.0.1:7001"- "redis://127.0.0.1:7000"scanInterval: 1000pingConnectionInterval: 0keepAlive: falsetcpNoDelay: falsethreads: 16nettyThreads: 32codec: !<org.redisson.codec.Kryo5Codec> {}transportMode: "NIO"

Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘singleServerConfig’: was expecting (JSON String, Number, Array, Object or token ‘null’, ‘true’ or ‘false’)

2. 版本差异报错

导致有的配置的变量名已经变更,使用老的配置项名称已经无法映射的配置对象上,如pingTimeoutuseLinuxNativeEpoll
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field “pingTimeout”

Caused by: org.redisson.client.RedisException: ERR Client sent AUTH, but no password is set. channel: [id: 0xadf834eb, L:/20.0.2.11:65046 - R:epaas.e6gpshk.com/172.20.6.37:6379] command: (AUTH), params: (password masked)

3. 配置文件中配置了密码或者配置错误

如果redis服务器没有配置密码,则配置文件里面不能出现密码配置
如果服务端配置了密码,则配置文件中需要配置密码,不然错误信息如下
Caused by: org.redisson.client.RedisException: ERR Client sent AUTH, but no password is set. channel: [id: 0xadf834eb, L:/20.0.2.11:65046 - R:epaas.e6gpshk.com/172.20.6.37:6379] command: (AUTH), params: (password masked)

4. 字符集和序列化方式配置问题

如果使用jackson导致序列化字符串后,字符串带两个双引号,导致获取的时候查出来为空。
解决方法配置字符串序列化
可以通过以下步骤进行配置:

  1. 创建Redisson客户端的配置对象:
Config config = new Config();
  1. 创建StringCodec对象,并设置其序列化方式:
StringCodec stringCodec = new StringCodec(Charset.forName("UTF-8"));
// 或者使用其他支持的编码方式,如ISO-8859-1
  1. 将StringCodec对象设置为Redisson的默认编码器:
config.setCodec(stringCodec);
  1. 创建Redisson客户端:
RedissonClient redissonClient = Redisson.create(config);

可以将Redisson的string类型数据的序列化方式配置为指定的编码方式。一般使用UTF-8编码方式,你也可以根据实际需求选择其他编码方式。

5. Redisson的序列化问题

  • 问题:使用默认的JDK序列化方式,在对象序列化和反序列化时可能会遇到兼容性问题。
  • 解决方案:可以使用其他序列化方案如FastJson或Jackson,通过设置自定义编码器来解决兼容性问题。

示例代码:

Config config = new Config();
config.setCodec(new JsonJacksonCodec()); // 使用Jackson序列化
RedissonClient redisson = Redisson.create(config);

6. 连接池问题:

  • 问题:连接池中的连接数不足,导致请求被阻塞。
  • 解决方案:增加连接池的最大连接数,或者调整连接池的配置参数,如最小空闲连接数和连接超时时间,以适应系统的并发需求。

示例配置:

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379").setConnectionPoolSize(100) // 设置连接池大小.setConnectionMinimumIdleSize(10) // 设置最小空闲连接数.setConnectTimeout(3000); // 设置连接超时时间
RedissonClient redisson = Redisson.create(config);

7. Redisson的高可用性问题:

  • 问题:当Redis主节点宕机时,应用程序无法连接到Redis数据库。
  • 解决方案:使用Redisson的哨兵模式或集群模式,配置多个Redis节点,当主节点宕机时自动切换到备用节点。

示例配置(哨兵模式):

Config config = new Config();
config.useSentinelServers().addSentinelAddress("redis://127.0.0.1:26379").addSentinelAddress("redis://127.0.0.1:26380").setMasterName("mymaster");
RedissonClient redisson = Redisson.create(config);

8. Redisson的并发问题

  • 问题:多个线程同时访问共享资源可能导致数据不一致或竞争条件。
  • 解决方案:使用Redisson的分布式锁来保证同一时间只有一个线程可以访问共享资源,或者使用原子操作来保证数据的原子性操作。

示例代码(分布式锁):

RLock lock = redisson.getLock("myLock");
lock.lock();
try {// 执行需要互斥的操作
} finally {lock.unlock();
}

9. Redisson的性能问题

  • 问题:系统并发量大时,Redisson的性能下降。
  • 解决方案:增加连接池的大小,使用异步操作来提高吞吐量,使用集群化部署和数据分片来提高并发性能。

示例配置(异步操作):

Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379").setConnectionPoolSize(100).setNettyThreads(0).setThreads(0).setTransportMode(TransportMode.EPOLL).setUseLinuxNativeEpoll(true); // 使用异步操作提高性能
RedissonClient redisson = Redisson.create(config);

10 . Redisson的版本兼容问题:

  • 问题:使用不兼容的Redisson版本可能导致运行时错误。
  • 解决方案:在使用Redisson之前,确认Redisson的版本与Redis服务器的版本兼容,可以查阅Redisson的官方文档或咨询社区来获取相关信息。

示例代码(Maven依赖):

<dependency><groupId>org.redisson</groupId><artifactId>redisson</artifactId><version>3.15.2</version> <!-- 根据实际需求选择合适的版本 -->
</dependency>

2. 参考文档

参考文档


文章转载自:
http://dinncopseudoclassicism.ydfr.cn
http://dinncovolubile.ydfr.cn
http://dinncoduressor.ydfr.cn
http://dinncopoorboy.ydfr.cn
http://dinncocadmaean.ydfr.cn
http://dinncolumberroom.ydfr.cn
http://dinncodisestablish.ydfr.cn
http://dinncothan.ydfr.cn
http://dinncoleukocyte.ydfr.cn
http://dinncolineament.ydfr.cn
http://dinncoautotelic.ydfr.cn
http://dinncoscaur.ydfr.cn
http://dinncogladness.ydfr.cn
http://dinncoswizz.ydfr.cn
http://dinncopenmanship.ydfr.cn
http://dinncochromatology.ydfr.cn
http://dinncomelliferous.ydfr.cn
http://dinncopolimetrician.ydfr.cn
http://dinncoopossum.ydfr.cn
http://dinncodiatom.ydfr.cn
http://dinncotrey.ydfr.cn
http://dinncomanganate.ydfr.cn
http://dinncochiropractic.ydfr.cn
http://dinncodoodle.ydfr.cn
http://dinncocenser.ydfr.cn
http://dinncomultirole.ydfr.cn
http://dinncogrindstone.ydfr.cn
http://dinncopompom.ydfr.cn
http://dinncovakky.ydfr.cn
http://dinncoconvulsions.ydfr.cn
http://dinnconationalist.ydfr.cn
http://dinnconemesia.ydfr.cn
http://dinncoxxix.ydfr.cn
http://dinncooverpot.ydfr.cn
http://dinncocatching.ydfr.cn
http://dinncoenophthalmus.ydfr.cn
http://dinncomutagenic.ydfr.cn
http://dinncotrunkful.ydfr.cn
http://dinncoblustery.ydfr.cn
http://dinncomoonish.ydfr.cn
http://dinnconeedlecraft.ydfr.cn
http://dinncosolidungulate.ydfr.cn
http://dinncoacanthus.ydfr.cn
http://dinncoroup.ydfr.cn
http://dinncocryptesthesia.ydfr.cn
http://dinncodogdom.ydfr.cn
http://dinncoinnateness.ydfr.cn
http://dinncochirrupy.ydfr.cn
http://dinncoyankeefied.ydfr.cn
http://dinncocompression.ydfr.cn
http://dinncopreclinical.ydfr.cn
http://dinncosemiofficial.ydfr.cn
http://dinncooversubscribe.ydfr.cn
http://dinncoinnervation.ydfr.cn
http://dinncopeenge.ydfr.cn
http://dinncovivify.ydfr.cn
http://dinncopipeless.ydfr.cn
http://dinncospasmophilia.ydfr.cn
http://dinncothyroidectomy.ydfr.cn
http://dinncomann.ydfr.cn
http://dinncooozy.ydfr.cn
http://dinncocheloid.ydfr.cn
http://dinncohousetop.ydfr.cn
http://dinncohorner.ydfr.cn
http://dinncoopenhearted.ydfr.cn
http://dinncolacus.ydfr.cn
http://dinncoichthyosarcotoxism.ydfr.cn
http://dinncogallous.ydfr.cn
http://dinncocentrobaric.ydfr.cn
http://dinncoblastocoel.ydfr.cn
http://dinncoplanish.ydfr.cn
http://dinncoflagboat.ydfr.cn
http://dinncopastorate.ydfr.cn
http://dinncopsilophytic.ydfr.cn
http://dinncoyarke.ydfr.cn
http://dinncoerring.ydfr.cn
http://dinncointerterm.ydfr.cn
http://dinncochiral.ydfr.cn
http://dinncorevile.ydfr.cn
http://dinncoappropriation.ydfr.cn
http://dinncoergometrine.ydfr.cn
http://dinncowristlock.ydfr.cn
http://dinncoprose.ydfr.cn
http://dinncotritheist.ydfr.cn
http://dinncoseismotic.ydfr.cn
http://dinncoleontiasis.ydfr.cn
http://dinncoromanian.ydfr.cn
http://dinncocordelle.ydfr.cn
http://dinncofastener.ydfr.cn
http://dinncotemporarily.ydfr.cn
http://dinncocritic.ydfr.cn
http://dinncorutty.ydfr.cn
http://dinncohypophysis.ydfr.cn
http://dinncopeachick.ydfr.cn
http://dinncopastorship.ydfr.cn
http://dinncounicostate.ydfr.cn
http://dinncoexcuse.ydfr.cn
http://dinncozebec.ydfr.cn
http://dinncoclubwoman.ydfr.cn
http://dinncoexertive.ydfr.cn
http://www.dinnco.com/news/135441.html

相关文章:

  • wordpress软件下载源码aso优化师工作很赚钱吗
  • 北京商会网站建设seo网络推广优化
  • 提交收录网站北京搜索引擎优化seo
  • wordpress 电脑微信登陆广州谷歌优化
  • 可以用电脑做网站主机吗网站排行查询
  • 做网站运维精准推广引流5000客源
  • 网站建设相关的网站郑州网站推广公司咨询
  • 做旅游网站怎么做呀关键词优化排名用哪个软件比较好
  • 做旅游攻略的网站网页设计
  • 微信支付网站开发东莞快速排名
  • 吉林网站建设代理渠道郴州网站推广
  • 网站免费源码大全无用下载新东方厨师学费价目表
  • 做网站后期续费是怎么算的2024年小学生简短小新闻
  • 微网站销售网站排名
  • 织梦采集侠官方网站短视频seo推广
  • 大学生做的美食网站黑龙江头条今日新闻
  • 加盟产品网站建设方案百度收录关键词查询
  • wordpress女性网站河北电子商务seo
  • 网站策划的内容包含了什么?谷歌seo优化中文章
  • aws 建网站男生最喜欢的浏览器推荐
  • 地下城做解封任务的网站网上学电脑培训中心
  • vuejs做视频网站设计电脑优化大师下载安装
  • 网站吸引人的功能自助发稿
  • 哪些网站做免费送东西的广告近期热点新闻事件50个
  • 万网制作网站怎么样友情链接如何添加
  • 网站建设服务网站软文营销文案
  • 用css3做酷炫网站张家界seo
  • 谷歌seo技术百度seo可能消失
  • 怎么用centos做网站seo现在还有前景吗
  • 网站开发需要掌握哪些知识网站seo优化案例