SCRIPT KILL

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

SCRIPT KILL

The conditions under which you can kill a running Lua script are as follows.

  1. lua-time-limit must be exceeded. Default is 5 seconds.
    Before that, no command can kill it. Lua scripts also run with atomicity.
    If you run a normal command before lua-time-limit, you get the following message.
    (error) BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE.
    After lua-time-limit, the following log is written to redis.log.
    Lua slow script detected: still in execution after 5001 milliseconds. You can try killing the script using the SCRIPT KILL command.
  2. If lua-time-limit has passed and the script has not executed a write command, you can kill the running script with SCRIPT KILL. When SCRIPT KILL runs, the following log is written to redis.log.
    Lua script killed by user with SCRIPT KILL.
  3. If lua-time-limit has passed and the script has executed a write command, you must kill the Redis server with SHUTDOWN NOSAVE. There is no other way.
  4. If you run SCRIPT KILL after the script has executed a write command, you get the following message.
    (error) UNKILLABLE Sorry the script already executed write commands against the dataset. You can either wait the script termination or kill the server in a hard way using the SHUTDOWN NOSAVE command.
  5. While a Lua script is running, the Redis server checks every second whether lua-time-limit has passed.

Example

Command>SCRIPT KILL
Result>OK
(2.65s)

Syntax

SCRIPT FLUSH

  • Available since version 2.6.0.
  • O(1)

<< SCRIPT FLUSH SCRIPT KILL SCRIPT DEBUG >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.