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

PHPRedis Cluster constants #48361

Closed
stemis opened this issue Sep 11, 2023 · 4 comments
Closed

PHPRedis Cluster constants #48361

stemis opened this issue Sep 11, 2023 · 4 comments

Comments

@stemis
Copy link
Contributor

stemis commented Sep 11, 2023

Laravel Version

10.16.1

PHP Version

8.1

Database Driver & Version

No response

Description

The PHPRedis library removed RedisCluster:: constants since 6.0.0. Released on pecl today 2023-09-11

However, these constants are still used:

$client->setOption(RedisCluster::OPT_PREFIX, $options['prefix']);

My build started failing today now that version 6.0.0 is on pecl, and I didn't lock down the pecl version.

I'm using cluster mode and have a prefix and the code is failing with:

Undefined constant RedisCluster::OPT_PREFIX
at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:191

The author of PHPREDIS recommends not using the constants of RedisCluster anymore but using the constants in Redis instead here: phpredis/phpredis#2262 (comment):

We updated how we create these class constants which is when I noticed I was duplicating all the constants for both classes. I think we want to only define them for Redis in the next version (which will be a major version bump)

I believe they are also backwards compatible as they were duplicated in Redis.php already.

Steps To Reproduce

  1. Use phpredis 6.0.0 (by default installed via PECL since today)
  2. Use cluster mode with a prefix

Workaround:

Instead of using pecl install redis, use pecl install redis-5.3.7

@driesvints
Copy link
Member

Thanks for the PR!

@ahmed-bhs
Copy link

ahmed-bhs commented Sep 22, 2023

@stemis what about if I'm using sudo apt install php8.2-redis in that case how to specify the 5.3.7 version of phpredis behind php8.2-redis ?

@ahmednabil2k
Copy link

@stemis Could you please provide me with your database.php configurations for phpredis cluster as I just keep getting an error Couldn't map cluster keyspace using any provided seed

@duycong2509
Copy link

duycong2509 commented Apr 15, 2024

@ahmednabil2k You should configure options in Redis like that
'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), 'prefix' => env('REDIS_PREFIX'), 'password' => [env('REDIS_USERNAME'), env('REDIS_PASSWORD')], ],

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

5 participants