#!/usr/bin/env python
# encoding: utf-8
#@author: 东哥加油!
#@file: clear_pool.py
#@time: 2018/8/28 17:06
from rediscluster import StrictRedisCluster
import datetime
import sys
def redis_cluster():
redis_nodes = [{'host':'192.168.15.6','port':6379},
{'host':'192.168.15.7','port':6379},
{'host':'192.168.15.6','port':6380},
{'host':'192.168.15.7','port':6380},
{'host':'192.168.15.8','port':6379},
{'host':'192.168.15.8','port':6380}
]
try:
redisconn = StrictRedisCluster(startup_nodes=redis_nodes)
return redisconn
except Exception:
print('Connect Error!')
sys.exit(1)
if __name__ == '__main__':
fp = open('/data/shell/sk.txt', 'ab+')
redisconn = redis_cluster()
_prize_pool = redisconn.get('_prize_pool')
n_prize = float(_prize_pool)/100
str1=str(datetime.datetime.now())+' 修改前的购物车数据: '+str(n_prize)+' 元\n'
print(str1)
str2=str1.encode('utf8')
fp.write(str2)
fp.close()