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
- zabbix_get :command not found 解決辦法
- JAVA IPMI Command time out 解決方法Java
- ORA-27102: out of memory解決辦法
- -bash: XXX: command not found解決辦法
- Myeclipse:resource is out of sync with the file system的解決辦法Eclipse
- 解決 connect to host github.com port 22 operation timed outGithub
- “command-not-found has crashed” 解決辦法 (*unsolved)
- mysql 匯入問題:Unknown command '\'' 解決辦法MySql
- java.net.SocketTimeoutException: Read timed out異常解決方法JavaException
- adb server is out of date.killing的解決辦法Server
- command 'gcc' failed with exit status 1錯誤問題的解決辦法GCAI
- Putty或MobaXTerm無法連線VMware虛擬機器 報Network error: Connection timed out的解決方案虛擬機Error
- Oracle RAC root.sh 報錯 Timed out waiting for the CRS stack to start 解決方法OracleAI
- [Clickhouse] Clickhouse 報SQLException : Read timed outSQLException
- sqlnet.log error - Operation timed outSQLError
- GoldenGate Pump Porcess: TCP/IP error 110 (Connection timed out)的問題解決GoTCPError
- github慢解決辦法Github
- Grub Rescue解決辦法
- /dev/null解決辦法devNull
- MSBuild Tools解決辦法UI
- ORA-13639: The CURRENT operation was interrupted because it timed OUT
- 檔案無法粉碎解決辦法
- OpenStack 的NAT解決辦法
- android ExceptionInInitializerError解決辦法AndroidExceptionError
- Could not find *.apk!解決辦法APK
- man出錯解決辦法
- ARP病毒解決辦法
- 公寓噪音的解決辦法
- oracle 11.2.0.3 grid ons 程式 checked timed outOracle
- 【Oracle】 inbound connection timed out (ORA-3136)Oracle
- 解決 command not found: expressExpress
- SSH 連線卡頓解決辦法
- 錕斤拷個人解決辦法
- 資料傾斜解決辦法
- ModuleNotFoundError: No module named ‘DBUtils‘解決辦法Error