io.lettuce.core.RedisCommandTimeoutException: Command timed out 解決辦法
問題描述:
專案開發的過程中,應業務需求將Redis作為快取伺服器整合進了Spring Boot的專案中,在初測試的時候,遇到連線超時的情況,錯誤資訊如下:
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 192.168.159.132:6379
at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:233)
at io.lettuce.core.RedisClient.connectStandalone(RedisClient.java:253)
at io.lettuce.core.RedisClient.connect(RedisClient.java:202)
at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:56)
at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:959)
... 41 more
Caused by: io.lettuce.core.RedisCommandTimeoutException: Command timed out
at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:114)
at io.lettuce.core.AbstractRedisAsyncCommands.auth(AbstractRedisAsyncCommands.java:81)
at io.lettuce.core.RedisClient.lambda$connectStatefulAsync$2(RedisClient.java:324)
at io.lettuce.core.RedisClient$$Lambda$436/1235678342.apply(Unknown Source)
at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)
at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
如下圖:
解決辦法:
解析Redis配置檔案,Redis主要的yaml配置檔案如下:
# redis 相關配置
redis:
# 資料庫索引
database: 0
# 遠端伺服器地址
host: 192.168.159.***
# 遠端伺服器埠
port: 6379
# 驗證碼
password: ******
jedis:
pool:
# 最大空閒連線
max-idle: 8
# 最小空閒連結
min-idle: 0
# 最大連線數(負數表示沒有限制)
max-active: 8
# 最大阻塞等待時間(負數表示沒有限制)
max-wait: 0
# 連結超時時間(毫秒)
timeout: 50
請注意,上面的配置引數,timeout 為 50,單位為毫秒,由此引數設定過小導致的,將這個引數設值得更大些,如200或以上!
timeout 這個在實際的生產環境中非常有用,就不具體的闡述了,自己去體會。。。
調整Redis的配置引數後,再次測試業務操作就成功了,如下圖:
好了,關於 io.lettuce.core.RedisCommandTimeoutException: Command timed out 解決辦法 就寫到這兒了,如果還有什麼疑問或遇到什麼問題歡迎掃碼提問,也可以給我留言哦,我會一一詳細的解答的。
歇後語:“ 共同學習,共同進步 ”,也希望大家多多關注CSND的IT社群。
相關文章
- 【解決】io.lettuce.core.RedisCommandTimeoutException: Command timed outRedisException
- 報錯(已解決)Command timed out after no timeout
- 【python】pip安裝庫時出現Read timed out.解決辦法Python
- -bash: XXX: command not found解決辦法
- JAVA IPMI Command time out 解決方法Java
- zabbix_get :command not found 解決辦法
- “command-not-found has crashed” 解決辦法 (*unsolved)
- java.net.SocketTimeoutException: Read timed out異常解決方法JavaException
- Putty或MobaXTerm無法連線VMware虛擬機器 報Network error: Connection timed out的解決方案虛擬機Error
- [Clickhouse] Clickhouse 報SQLException : Read timed outSQLException
- command 'gcc' failed with exit status 1錯誤問題的解決辦法GCAI
- Springboot2.x整合lettuce連線redis叢集報超時異常Command timed out after 6 second(s)Spring BootRedis
- Failed to connect to ESP8266: Timed out waiting for packet headerAIHeader
- [debug] vagrant報錯mount.nfs: Connection timed outNFS
- WARNING: inbound connection timed out (ORA-3136)錯誤分析
- jdbc訪問KingbaseES資料庫SocketTimeoutException Read timed outJDBC資料庫Exception
- java.sql.SQLException:IO 錯誤:Socket read timed out !JavaSQLException
- github慢解決辦法Github
- Namespoace Terminating 解決辦法
- 檔案無法粉碎解決辦法
- 部分OPPO機型 AssetManager.finalize() timed out的修復
- oozie.action.hadoop.LauncherException: IO error Connection timed out: no further informationHadoopExceptionErrorORM
- Feign,HTTP連線超時問題SocketTimeoutException: Read timed outHTTPException
- 執行systemctl status ssh返回“Failed to get properties: Connection timed out”AI
- 公寓噪音的解決辦法
- height:100%失效解決辦法
- 記vscode無法啟動解決辦法VSCode
- RetryableException: Read timed out executing導致服務假死無響應Exception
- java.sql.SQLRecoverableException: IO Error: Socket read timed out 排查歷程JavaSQLExceptionError
- QT6安裝Android SDK出現"Android SDK Command-line Tools run"出錯解決辦法QTAndroid
- cnpm link 報錯解決辦法NPM
- mysql事件關閉解決辦法MySql事件
- IDEA 找不到包解決辦法Idea
- 資料傾斜解決辦法
- SpringBoot 迴圈引用解決辦法Spring Boot
- VScode 更新失敗解決辦法VSCode
- npm install 失敗解決辦法NPM
- github訪問受限解決辦法Github