本文整理汇总了Python中rediscluster.StrictRedisCluster.info方法的典型用法代码示例。如果您正苦于以下问题:Python StrictRedisCluster.info方法的具体用法?Python StrictRedisCluster.info怎么用?Python StrictRedisCluster.info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rediscluster.StrictRedisCluster
的用法示例。
在下文中一共展示了StrictRedisCluster.info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getRedisKeyValues
# 需要导入模块: from rediscluster import StrictRedisCluster [as 别名]
# 或者: from rediscluster.StrictRedisCluster import info [as 别名]
def getRedisKeyValues(host, port, keyFilter):
try:
startup_nodes = [{"host": host, "port": port}]
rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
info = rc.info()
for key in info:
print "%s: %s" % (key, info[key])
result = []
# keysCount = len(rc.keys())
count = 0
for key in rc.keys():
if count >= 1024:
break
else:
if key.find(keyFilter) != -1:
count += 1
# 查询类型
# (key, value)
result.append([key, getValue(rc, key)])
# pprint.pprint("type:" + rc.type(key) + "$key:" + key + "$value:" + getValue(rc, key))
# print rc.get(key)
return result
except Exception, e:
return [["<font color='red'>Error Info</font>", "<font color='red'>%s</font>" % (str(e) + "<br/>请检查ip和端口是否正确")]]
示例2: StrictRedisCluster
# 需要导入模块: from rediscluster import StrictRedisCluster [as 别名]
# 或者: from rediscluster.StrictRedisCluster import info [as 别名]
if __name__ == "__main__":
hostIp = "10.230.136.108"
# __pool = redis.ConnectionPool(host=hostIp, port=7000, db=0)
# r = redis.Redis(connection_pool=__pool)
startup_nodes = [{"host": hostIp, "port": "6419"}]
# startup_nodes = [{"host": "10.230.136.69", "port": "7000"},
# {"host": "10.230.136.70", "port": "7000"},
# {"host": "10.230.136.71", "port": "7000"}]
rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
# print rc.get("foo")
info = rc.info()
# for key in info:
# print "%s: %s" % (key, info[key])
# pprint.pprint(dir(rc))
print "-------------------"
# pprint.pprint( rc.keys())
# zset
rc.zadd("zset_", 9000, "zset.cc")
# set
rc.sadd("set_", "set.cc")
# hash
rc.hset("hash", "filed", "123456789")