[redis]redis集羣不支持事務multi、exec

  • multi後不能執行get,沒有結果返回的
  • 也不能redirected,不然exec不行
132.120.2.134:26000> MULTI
OK
132.120.2.134:26000> get abc
QUEUED
132.120.2.134:26000> GET ABC
-> Redirected to slot [14740] located at 132.120.2.135:26001
(nil)
132.120.2.135:26001> SET ABC 2
OK
132.120.2.135:26001> GETSET
(error) ERR wrong number of arguments for 'getset' command
132.120.2.135:26001> EXEC
(error) ERR EXEC without MULTI

set若是redirected一樣不行code

132.120.2.135:26001> multi
OK
132.120.2.135:26001> set abc 1
-> Redirected to slot [7638] located at 132.120.2.134:26000
OK

multi能夠小寫,命令不區分大小寫。 可是key區分。abc和ABC不一樣。事務

  • 若是先set,再expire,可用set EX代替事務
132.120.2.134:26000> set abc 212 EX 30
OK
相關文章
相關標籤/搜索