Redis Scripting: SCRIPT KILL
Redis SCRIPT KILL Command
Redis SCRIPT KILL command is used to kill the currently executing Lua script, assuming no write operation was yet performed by the script. This command is mainly useful to kill a script that is running for too much time. If the script already performed write operations it can not be killed in this way because it would violate Lua script atomicity contract. In such a case only SHUTDOWN NOSAVE is able to kill the script, killing the Redis process in a hard way preventing it to persist with half-written information.
Here are some common uses and scenarios for the "SCRIPT KILL" command:
- Abort Long-Running Scripts: Terminates the execution of a currently running Lua script that exceeds its expected runtime.
- Prevent Server Hang: Prevents the server from becoming unresponsive due to long-running or infinite-loop scripts.
- Error Handling: Provides a way to handle and stop scripts that encounter errors or unexpected conditions, ensuring server stability.
- Resource Management: Frees up server resources being consumed by a problematic script, allowing other operations to proceed.
Syntax:
SCRIPT KILL
Available since
2.6.0.
Return Value
Simple string reply
Return Value Type
String
Example:
redis 127.0.0.1:6379> SCRIPT KILL OK
Previous:
SCRIPT FLUSH
Next:
SCRIPT LOAD
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://www.w3resource.com/redis/redis-script-kill.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics