Skip to content

Instantly share code, notes, and snippets.

@wangshuai1992
Created November 23, 2022 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wangshuai1992/593d53f03f5eeed78ef53a206da2ae87 to your computer and use it in GitHub Desktop.
Save wangshuai1992/593d53f03f5eeed78ef53a206da2ae87 to your computer and use it in GitHub Desktop.
show redis connection number by ip
#!/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