yiisoft / yii2-redis

Yii 2 Redis extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
452 stars 183 forks source link

Connect to Redis Cluster in Yandex Cloud #211

Closed abpopov closed 4 years ago

abpopov commented 4 years ago

Hello! Is there any way to connect to Yandex Cloud

$sentinels = ['tcp://host:port']; $options = [ 'replication' => 'sentinel', 'service' => 'service_name', 'parameters' => [ 'password' => '' ] ];

yii-bot commented 4 years ago

Thanks for posting in our issue tracker. In order to properly assist you, we need additional information:

Thanks!

This is an automated comment, triggered by adding the label status:need more info.

abpopov commented 4 years ago

We want to use https://cloud.yandex.ru/docs/managed-redis/operations/cluster-create and in Yandex cloud help I got

`sudo pear channel-discover pear.nrk.io sudo pear install nrk/Predis Пример кода: require 'Predis/Autoloader.php'; Predis\Autoloader::register();

$sentinels = ['tcp://server:port]; $options = [ 'replication' => 'sentinel', 'service' => 'cluster_name', 'parameters' => [ 'password' => '' ] ]; $client = new Predis\Client($sentinels, $options);

$client->set('foo', 'bar');`

Can I use yii2-redis to connect to this Yandex cloud redid cluster?

samdark commented 4 years ago

I think so. Why not?

abpopov commented 4 years ago

How?)

Connection config of yii2-redis

'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => 'localhost', 'port' => 6379, 'database' => 0, ],

abpopov commented 4 years ago

I see in YandexCloud FAQ that we can use direct connection. Is there any way to connect via Redis Sentinel?

samdark commented 4 years ago

Checked it. I have no idea if current code is suitable. It supports multiple replicas but I have no idea on how to work with sentinel on the low level.

samdark commented 4 years ago

Here it is: https://github.com/yiisoft/yii2-redis/issues/45