Redis commands


Mukesh Kulal

2021-10-30 16:51:48


 

1) To identify big keys which are using up much space in redis

[shell-cmd]# redis-cli --bigkeys

 

# Scanning the entire keyspace to find biggest keys as well as

# average sizes per key type.  You can use -i 0.1 to sleep 0.1 sec

# per 100 SCAN commands (not usually needed).

 

[00.00%] Biggest string found so far 'key1' with 9 bytes

[00.00%] Biggest string found so far 'key2 with 62 bytes

[00.00%] Biggest string found so far 'key3' with 5110 bytes

[00.00%] Biggest string found so far 'key4' with 41815 bytes

[01.02%] Biggest string found so far 'key5' with 164794 bytes

[02.14%] Biggest string found so far 'key6' with 515013 bytes

[78.64%] Biggest string found so far 'key7' with 515463 bytes

 

 

2) To identify stats about redis usage

[shell-cmd]# redis-cli --stat

------- data ------ --------------------- load -------------------- - child -

keys       mem      clients blocked requests            connections          

1228       44.43M   1522    0       38933 (+0)          17730       

1239       44.62M   1521    0       38968 (+35)         17740       

1243       44.64M   1522    0       38983 (+15)         17745       

1244       44.67M   1522    0       38989 (+6)          17746       

1245       44.62M   1521    0       39008 (+19)         17746       

1249       44.64M   1522    0       39024 (+16)         17750 

 

3) To identify connected list 

[shell-cmd]# redis-cli client list

id=20590 addr=127.0.0.1:49024 fd=700 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20591 addr=127.0.0.1:49026 fd=701 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20592 addr=127.0.0.1:49028 fd=718 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20593 addr=127.0.0.1:49030 fd=719 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20594 addr=127.0.0.1:49032 fd=720 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20595 addr=127.0.0.1:49034 fd=721 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20596 addr=127.0.0.1:49036 fd=722 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20597 addr=127.0.0.1:49038 fd=723 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20598 addr=127.0.0.1:49040 fd=724 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20599 addr=127.0.0.1:49042 fd=725 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20600 addr=127.0.0.1:49044 fd=726 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20601 addr=127.0.0.1:49046 fd=727 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

id=20602 addr=127.0.0.1:49048 fd=702 name= age=43 idle=13 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=ping

 

4) To check connected count of clients

[shell-cmd]# redis-cli info clients