pythonredisredis-pyhyperloglog

HyperLogLog Implementation on Redis Not Recognized


I'm trying to run a simple code here which simply inserts a value into a key using the PFADD operation but I get this error:

ResponseError: unknown command 'PFADD'

My code is as follows:

import pandas as pd
import redis
r = redis.StrictRedis(host='localhost', port=6379, db=0)
r.pfadd("k", 2, 3, 4, 4, 5, 6, 7, 3, 4,)

Am I missing something here?


Solution

  • Issue a r.execute_command("PFADD", "key", 1, 2, 3) to see if your server supports the command.

    If this command runs ok, then the issue is with redis-py.

    Edit

    http://redis.io/commands/pfadd was added in Redis 2.8.9, your version is older than this.

    You probably can do your stuff using http://redis.io/commands/sadd, which is supported in early versions. Check this link and try the set commands. They are slower in counting members, but are deterministic.