Redis集群之Redis Cluster(3)

from rediscluster import StrictRedisCluster
startup_nodes = [{
"host": "10.24.6.7", "port": "6379"}]
rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)
print rc.set("bbbbbbbbbbbbbbbb", "bar")
True
print rc.get("bbbbbbbbbbbbbbbb")

6.2.3. Redis Sentinel + Cluster

from redis.sentinel import Sentinel
from redisclusterimport StrictRedisCluster
sentinel = Sentinel([(
'10.24.6.7', 26379)], socket_timeout=0.1)
ip, port = sentinel.discover_master(
'10.24.6.5master')
rc = StrictRedisCluster(host=ip, port=port, decode_responses=True)
print rc.set("bbbbbbbbbbbbbbbb", "bar")
print rc.get("bbbbbbbbbbbbbbbb")

下面关于Redis的文章您也可能喜欢,不妨参考下:

Ubuntu 14.04下Redis安装及简单测试

Redis主从复制基本配置

Redis集群明细文档

Ubuntu 12.10下安装Redis(图文详解)+ Jedis连接Redis

Redis系列-安装部署维护篇

CentOS 6.3安装Redis

Redis安装部署学习笔记

Redis配置文件redis.conf 详解

Redis 的详细介绍请点这里
Redis 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/fbae02cb18bc31340d4db84dc07ae760.html