redis CLIENT KILL command


  Translation results:

client

UK[ˈklaɪənt] US[ˈklaɪənt]

n.Customer;Party;Litigation client;[Computer]Client

Plural: clients

kill

##英[kɪl] 美[kɪl]

vt.& vi.Kill…

vt. To stop [end, fail]; to destroy, weaken, offset; to cause pain, to be tortured; to make one laugh so hard, to laugh to death

n. to kill; to hunt; to kill an animal ;Prey

adj. Deadly

Third person singular: kills Present participle: killing Past tense: killed Past participle: killed

redis CLIENT KILL commandsyntax

Function:Close the client with the address ip:port.

Syntax: CLIENT KILL ip:port

Description: ip:port should match one of the lines output by the CLIENT LIST command. Because Redis uses a single-threaded design, no client will be disconnected while Redis is executing commands. If the client to be disconnected is executing a command, then when the command is executed and the next command is sent, it will receive a network error telling it that its connection has been closed.

Available versions: >= 2.4.0

Time complexity: O(N), N is the number of connected clients .

Return: When the specified client exists and is successfully closed, OK is returned.

redis CLIENT KILL commandexample

# 列出所有已连接客户端
redis 127.0.0.1:6379> CLIENT LIST
addr=127.0.0.1:43501 fd=5 age=10 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
# 杀死当前客户端的连接
redis 127.0.0.1:6379> CLIENT KILL 127.0.0.1:43501
OK
# 之前的连接已经被关闭,CLI 客户端又重新建立了连接
# 之前的端口是 43501 ,现在是 43504
redis 127.0.0.1:6379> CLIENT LIST
addr=127.0.0.1:43504 fd=5 age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client

Home

Videos

Q&A