python2监控redis读取速度
2021-02-01 00:17
标签:spl import 后台运行 imp oca monit start moni int 1、主要是导入redis模块,如果不存在则执行pip install redis 安装。 2、放到后台运行并写入文件 python2监控redis读取速度 标签:spl import 后台运行 imp oca monit start moni int 原文地址:https://www.cnblogs.com/Dev0ps/p/12815286.html#!/usr/bin/env python
import redis
import time
ip=‘10.12.41.16‘
password=‘Tvgpg#cdz‘
r=redis.Redis(host=ip,password=password,port=16379,db=0)
while True:
localtime = time.asctime( time.localtime(time.time()) )
start_time = time.time()
res=r.get(‘k1‘)
end_time = time.time()
time.sleep(5)
running_time = end_time - start_time
print("keys:%s running_time : %.5f sec localtime:%s" %(res,running_time,localtime))
[root@db redis_monitor]# nohup -u check_python.py >redis_out.txt &
文章标题:python2监控redis读取速度
文章链接:http://soscw.com/index.php/essay/49275.html