Connect to a Redis cluster with Python

To connect to a Redis server with Python, one can use python3-redis module. First verify that python3-redis module is installed. I’m showing the package name in Fedora 39, if you use a different distro, then check for the relevant package name. $ rpm -q python3-redis python3-redis-4.3.3-1.el9.noarch Here is the sample code to connect to a non-cluster Redis server: import redis # Connect to Redis r = redis.Redis(host='10.97.147.175', port=6379) # Set a key-value pair r....

April 3, 2024 · 1 min · 191 words · kenno