1. 安装依赖

pip install redis-py-cluster

2. 连接集群

from rediscluster import RedisCluster

r = RedisCluster(startup_nodes=[{"host": "192.168.1.101", "port": 6381},{"host": "192.168.1.102", "port": 6379}], password='123456')

3. 检查连接

r.ping()

参考: python 操作redis集群

相关文章:

  • 2021-06-07
  • 2021-06-06
  • 2021-07-16
  • 2021-09-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2021-07-24
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-21
相关资源
相似解决方案