发布时间:2019-09-17 07:43:32编辑:auto阅读(2808)
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三种方法
55120
41923
36504
31909
26814
26485
25023
20646
16554
15968
3182°
2879°
2972°
3122°
3056°
3333°
3232°
3063°
3054°
3034°