原文:springboot redis 用RedisTemplate執行lua腳本報錯:@user_script:1: ERR value is not an integer or out of range

代碼如下: 錯誤如下: org.springframework.data.redis.RedisSystemException: Error in execution nested exception is io.lettuce.core.RedisCommandExecutionException: ERR Error running script call to f dce e aa a dc ...

2020-06-30 13:55 0 1360 推薦指數:

查看詳情

SpringBoot通過RedisTemplate執行Lua腳本

   Redis使用的是內存,內存的速度比磁盤速度肯定要快很多.。使用 Redis實現搶紅包,需要知道的是Redis的功能不如數據庫強大,事務也不是很完整.因此要保證數據的正確性,可以通過嚴格的驗證得以保證。而 RedisLua 語言是原子性的,且功能更為強大,所以優先選擇使用Lua語言來實現 ...

Thu Jun 27 05:11:00 CST 2019 0 2466
執行lua腳本報錯ERR 'EVAL' command keys must in same slot.

異常日志 原因分析 測試環境為單機版,線上環境為集群版,導致同樣的lua腳本,在線上出錯。 lua腳本為保證事務,傳入的key必須是在同一個slot中。Redis集群引入了哈希槽的概念,一共有16348個slot,然后根據 CRC16(key) mod 16384 來計算放入哪個slot中 ...

Sat Sep 12 01:01:00 CST 2020 0 571
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM