Files
his/check_redis3.py

12 lines
408 B
Python

import redis, time
r = redis.Redis(host='192.168.110.252', port=6379, password='Jchl1528', db=1, socket_timeout=5)
count = r.dbsize()
print('Keys in DB1:', count)
keys = r.keys('*')
for k in keys[:20]:
raw = r.get(k)
if raw:
s = raw.decode('utf-8', errors='replace')[:120]
print(' ' + k.decode()[:50] + ' => ' + s)
else:
print(' ' + k.decode()[:50] + ' => (hash/other)')