Pytohn 操作Redis—Redis Sentinel(集群)

分手后的思念是犯贱 2022-01-15 22:19 339阅读 0赞

为什么80%的码农都做不了架构师?>>> hot3.png

Sentinel:http://doc.redisfans.com/topic/sentinel.html

Redis 的 Sentinel 系统用于管理多个 Redis 服务器,执行三个任务:监控,提醒,自动故障迁移。

启动Redis:redis-server redis.windows.conf

启动Redis Sentinel: redis-server sentinel.windows.conf —sentinel

  1. # Redis Sentinel
  2. from redis.sentinel import Sentinel
  3. sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.3, db=15, decode_responses=True)
  4. master = sentinel.master_for('madeira')
  5. slave = sentinel.slave_for('madeira')
  6. # redis 增删改查
  7. master.set('foo', 'bar')
  8. slave.get('foo')
  9. master.delete('foo')

转载于:https://my.oschina.net/xxWang/blog/778990

发表评论

表情:
评论列表 (有 0 条评论,339人围观)

还没有评论,来说两句吧...

相关阅读