Commit 581ab47e authored by 郭羽's avatar 郭羽

get redis keys test

parent 6685c3da
import redis import redis
import json import json
import time import time
import pymysql
def getRedisConn(): def getRedisConn():
conn = redis.Redis(host="172.18.51.10", port=6379,db=0) conn = redis.Redis(host="172.18.51.10", port=6379,db=0)
return conn return conn
...@@ -31,10 +32,30 @@ def getRedisConn4(): ...@@ -31,10 +32,30 @@ def getRedisConn4():
# conn = redis.Redis(connection_pool=pool) # conn = redis.Redis(connection_pool=pool)
# return conn # return conn
def getDeviceIds():
ids_set = set()
db = pymysql.connect(host='172.16.30.136', port=3306, user='doris_olap', passwd='bA27hXasdfswuolap',
db='doris_olap')
sql = "select distinct cl_id from user_tag3_portrait;"
cursor = db.cursor()
cursor.execute(sql)
datas = cursor.fetchall()
for d in datas:
device_id = str(d[0])
if device_id and len(device_id) > 0:
ids_set.add(str(d[0]))
print("deviceIds size:{}".format(str(len(ids_set))))
return ids_set
if __name__ == '__main__': if __name__ == '__main__':
# conns = [getRedisConn1(),getRedisConn2(),getRedisConn3(),getRedisConn4(),getRedisConn5()] # conns = [getRedisConn1(),getRedisConn2(),getRedisConn3(),getRedisConn4(),getRedisConn5()]
conns = [getRedisConn1(),getRedisConn2(),getRedisConn3(),getRedisConn4()] # conns = [getRedisConn1(),getRedisConn2(),getRedisConn3(),getRedisConn4()]
conns = [getRedisConn2(),getRedisConn3(),getRedisConn4()]
for index,conn in enumerate(conns): for index,conn in enumerate(conns):
start = int(time.time()) start = int(time.time())
num = 0 num = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment