[Solved] redis.exceptions.ResponseError: unknown command `KEYS`

Error message

When querying redis using python, all key information will be reported as errors

redis.exceptions.ResponseError: unknown command `KEYS`, with args beginning with: `*`, 

The code is as follows

import redis

pool = redis.ConnectionPool(host='127.0,0.1', port=6379, db=0, password='123456')
r = redis.StrictRedis(connection_pool=pool_16_6)
print(r.keys())

Solution:

for key in r.scan_iter("*"):
     print(key)

Read More: