发布时间:2019-09-17 07:43:32编辑:auto阅读(1900)
notes-------
(1)redis3.x集群模式操作需要List of all supported python versions.2.7/3.2/3.3/3.4.1+/3.5
#!/usr/bin/python
# -*- coding: UTF-8 -*-
#-------------------------------------------------------------------------------
# Name:
# Author: yangsq
# Email: shuqiang.yang@msxf.com
# Created: 14/03/2016
# requirement: python >=2.7
#-------------------------------------------------------------------------------
import redis
from rediscluster import StrictRedisCluster
import os, time, sys
serverip = "127.0.0.1"
startup_nodes = [{"host":serverip, "port":port} for port in xrange(7000,7006)]
def connRedisCluster():
rc = StrictRedisCluster(startup_nodes=startup_nodes)
return rc
def public_article(conn, article, user, title, link):
conn.hmset(article, {'title':title, 'publicer':user, 'link':link})
if __name__=='__main__':
print startup_nodes
rc = connRedisCluster()
public_article(rc, 'chinese_history', 'yangsq', 'war', 'http://goon')
print rc.hgetall('chinese_history')
上一篇: Ubuntu下为python下载pyth
下一篇: Python实现抽象基类的3三种方法
48623
47620
38415
35636
30083
26807
25814
20690
20441
18838
135°
212°
257°
265°
265°
262°
307°
362°
491°
484°