wget https://github.com/downloads/andymccurdy/redis-py/redis-2.4.10.tar.gz
sudo python setup.py installwhile true; do ./dump.py; sleep 10; done
dump.py
#!/usr/ali/bin/python
# -*- coding:utf8 -*-
import redis
def dump(ip, port, name):
try:
server = redis.Redis(ip, port, db=0)
keynum = server.dbsize()
memsize = server.info()['used_memory_human']
print "%s %s:%d keyNum:%d memSize:%s" % (name, ip, port, keynum, memsize)
except:
print "%s %s:%d connect exception" % (name, ip, port)
if __name__ == "__main__":
print "\nredis status ................."
dump('10.249.211.91', 6379, 'front')
dump('10.249.211.96', 6379, 'front')
dump('10.249.211.16', 6379, 'front')
dump('10.249.212.10', 6379, 'backup')
dump('10.249.211.21', 6379, 'backup')
dump('10.249.212.15', 6379, 'master')
dump('10.249.211.46', 6379, 'slave')
print "redis status .................\n"