python连接redis3.x集群并做

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:       [email protected]  # 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')