利用python操作redis-cluster


  In [8]: def redis_cluster():
...: redis_nodes = [{'host':'192.168.100.60','port':7000},
...: {'host':'192.168.100.60','port':7001},
...: {'host':'192.168.100.60','port':7002},
...: {'host':'192.168.100.60','port':7003},
...: {'host':'192.168.100.60','port':7004},
...: {'host':'192.168.100.60','port':7005}
...: ]
...: redisconn = StrictRedisCluster(startup_nodes=redis_nodes)
...: redisconn.set('name','admin')
...: redisconn.set('age',18)
...: print("name is:",redisconn.get('name'))
...: print(redisconn.get('name'),redisconn.get('age'))
...:

In [9]: redis_cluster()
name is: b'admin'
b'admin' b'18'

In [10]: 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM