Created
November 23, 2022 07:20
-
-
Save wangshuai1992/593d53f03f5eeed78ef53a206da2ae87 to your computer and use it in GitHub Desktop.
show redis connection number by ip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
host=$1 | |
port=$2 | |
redis-cli -h $host -p $port client list | awk '{print $2}'| cut -d = -f 2| cut -d : -f 1 | sort | uniq -c | sort -rn | awk '{"host " $2 | getline h; print $1 " " $2 " " h;}'| awk '{print $1 " " $2 " " $7}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment