#! /usr/bin/env python3 from rediscluster import RedisCluster startup_nodes = [{"host": "127.0.0.1", "port": "19901"}] rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True) slots = rc.cluster_slots() print("%5s - %-5s %-15s %7s %s" %("start", "end", "IP", "Port", "Replicas")) for slot in sorted(slots): print("%5d - %5d %-15s %7d %d" %(slot[0], slot[1], slots[slot]['master'][0], slots[slot]['master'][1], len(slots[slot]['slaves'])))