test.py 551 B

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/env python3
  2. import json
  3. import logging
  4. import sys
  5. from redis import Redis
  6. logging.basicConfig(level=logging.INFO)
  7. def main():
  8. redis = RedisCluster(
  9. startup_nodes=[
  10. {"host": "xxx.yyy.clustercfg.zzz1.cache.amazonaws.com", "port": "6379"}
  11. ],
  12. decode_responses=True,
  13. skip_full_coverage_check=True,
  14. )
  15. if redis.ping():
  16. logging.info("Connected to Redis")
  17. else:
  18. logging.error("Could not connect to Redis")
  19. sys.exit(-1)
  20. if __name__ == "__main__":
  21. main()