Is there any way to get client IP address in redis?

I did a web search but found nothing. I am running redis in a cluster and would like to know which machine is connecting to redis (especially when no machine should connect, but redis still says that some machine is connected).

early.

+6
source share
2 answers

With MONITOR, only clients that actually send traffic to Redis will be shown. If you just need to get a list of connected clients, you can use the CLIENT LIST command.

$ redis-cli client list 

It will return a table whose fields are described there:

Redis "Customer List" goals and descriptions

+8
source

Have you tried the MONITOR command?

http://redis.io/commands/monitor

  $ redis-cli monitor 1339518083.107412 [0 127.0.0.1:60866] "keys" "*" 1339518087.877697 [0 127.0.0.1:60866] "dbsize" 1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6" 1339518096.506257 [0 127.0.0.1:60866] "get" "x" 1339518099.363765 [0 127.0.0.1:60866] "del" "x" 1339518100.544926 [0 127.0.0.1:60866] "get" "x" Use SIGINT (Ctrl-C) to stop a MONITOR stream running via redis-cli. # OR $ telnet localhost 6379 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. MONITOR +OK +1339518083.107412 [0 127.0.0.1:60866] "keys" "*" +1339518087.877697 [0 127.0.0.1:60866] "dbsize" +1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6" +1339518096.506257 [0 127.0.0.1:60866] "get" "x" +1339518099.363765 [0 127.0.0.1:60866] "del" "x" +1339518100.544926 [0 127.0.0.1:60866] "get" "x" QUIT +OK Connection closed by foreign host. 
+3
source

Source: https://habr.com/ru/post/921357/


All Articles