Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use 'KEYS' with redis-cluster. #93

Open
fredams opened this issue Oct 25, 2019 · 3 comments
Open

Cannot use 'KEYS' with redis-cluster. #93

fredams opened this issue Oct 25, 2019 · 3 comments

Comments

@fredams
Copy link

fredams commented Oct 25, 2019

Hi,
i'm using predis, but when i start the workers i'm getting this message:

** [12:21:53 2019-10-25] Starting worker 
                                       
  [Predis\NotSupportedException]         
  Cannot use 'KEYS' with redis-cluster.  

Config file:

predis:
  namespace:  namespace
  config:
    - "tcp://server1:9991"
    - "tcp://server1:9992"
    - "tcp://server1:9993"
  options:
    cluster: "redis"

Can anyone help me please?
thanks

@scones
Copy link
Contributor

scones commented Oct 28, 2019

is there a stacktrace too?

@fredams
Copy link
Author

fredams commented Oct 28, 2019

Sure

** [12:21:53 2019-10-25] Starting worker 

                                         
  [Predis\NotSupportedException]         
  Cannot use 'KEYS' with redis-cluster.  
                                         

Exception trace:
 () at WORK_DIR/composer/vendor/predis/predis/src/Connection/Aggregate/RedisCluster.php:380
 Predis\Connection\Aggregate\RedisCluster->getConnection() at WORK_DIR/composer/vendor/predis/predis/src/Connection/Aggregate/RedisCluster.php:550
 Predis\Connection\Aggregate\RedisCluster->retryCommandOnFailure() at WORK_DIR/composer/vendor/predis/predis/src/Connection/Aggregate/RedisCluster.php:593
 Predis\Connection\Aggregate\RedisCluster->executeCommand() at WORK_DIR/composer/vendor/predis/predis/src/Client.php:331
 Predis\Client->executeCommand() at WORK_DIR/composer/vendor/predis/predis/src/Client.php:314
 Predis\Client->__call() at n/a:n/a
 call_user_func_array() at WORK_DIR/composer/vendor/mjphaynes/php-resque/src/Resque/Redis.php:340
 Resque\Redis->__call() at WORK_DIR/composer/vendor/mjphaynes/php-resque/src/Resque/Worker.php:846
 Resque\Worker->cleanup() at WORK_DIR/composer/vendor/mjphaynes/php-resque/src/Resque/Worker.php:402
 Resque\Worker->startup() at WORK_DIR/composer/vendor/mjphaynes/php-resque/src/Resque/Worker.php:235
 Resque\Worker->work() at WORK_DIR/composer/vendor/mjphaynes/php-resque/src/Resque/Commands/Worker/Start.php:73
 Resque\Commands\Worker\Start->execute() at WORK_DIR/composer/vendor/symfony/console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at WORK_DIR/composer/vendor/symfony/console/Application.php:841
 Symfony\Component\Console\Application->doRunCommand() at WORK_DIR/composer/vendor/symfony/console/Application.php:206
 Symfony\Component\Console\Application->doRun() at WORK_DIR/composer/vendor/symfony/console/Application.php:125

@xelan
Copy link
Collaborator

xelan commented Nov 4, 2019

Thanks for reporting this issue, @fredams and for the quick response, @scones!

Apparently, KEYS should not be used according to the Redis-Docs[1], so the Predis Library used by php-resque does not support it for clustered configurations[2].

The best solution would be to refactor the related code to use SCAN or Redis sets instead of KEYS. PRs are welcome for that 😄

[1] https://redis.io/commands/keys
[2] predis/predis#172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants