I'm running AWS Redis Elasticache with cluster mode on, but when trying to execute JSON.SET/JSON.GET trough Predis lib, I get "NotSupportedException" as you can see below:
Fatal error: Uncaught Predis\NotSupportedException: Cannot use 'JSON.SET' with redis-cluster. in predis-1.1.1/src/Connection/Aggregate/RedisCluster.php:380 Stack trace: #0
predis-1.1.1/src/Connection/Aggregate/RedisCluster.php(550): Predis\Connection\Aggregate\RedisCluster->getConnection() #1
predis-1.1.1/src/Connection/Aggregate/RedisCluster.php(593): Predis\Connection\Aggregate\RedisCluster->retryCommandOnFailure() #2
predis-1.1.1/src/Client.php(294): Predis\Connection\Aggregate\RedisCluster->executeCommand() #3
I'm running Predis 1.1.1(due to compatibility with 3rd party softwares)
This is my code:
require('predis-1.1.1/autoload.php');
try{
$redis = new Predis\Client(['xxxxx.clustercfg.region.cache.amazonaws.com:6379'],['cluster'=>'redis', 'scheme' => 'tcp', 'port' => 6379]);
}
catch(Exception $ex){
error_log("Error => ".$ex->getMessage());
}
$redis->executeRaw(['JSON.SET','teste123abc','.','[{"name":"nick","years":"20"}]']));
//This same command works in redis with cluster mode disabled
Isn't this supposed to work?
These commands works properly:
$redis->set('MyExampleTestKey1','testing'); // this works fine
$redis->executeRaw(['SET', 'MyExampleTestKey2', 'testing']); // this works fine
What can I do to fix this?