kuzzleio / kuzzle-plugin-cluster

Kuzzle cluster mode
Apache License 2.0
7 stars 2 forks source link

detect redis master from sentinel #87

Closed Perfect-Web closed 4 years ago

Perfect-Web commented 5 years ago

is this supported ?

benoitvidis commented 5 years ago

I am not sure I get your question but kuzzle's cluster uses ioredis to connect to Redis.

The lib has full support for sentinels and if so, guarantees the connected node is a master one, even after a failover.

By default, the cluster will use the same redis configuration as Kuzzle's one. You can for instance, setup your .kuzzlerc file to somehting like

{
  "services": {
    "internalCache": {
      "backend": "redis",
      "node": {
        "sentinels": [
          {
            "host": "sentinel1",
            "port": 26379
          },          {
            "host": "sentinel2",
            "port": 26379
          },          {
            "host": "sentinel3",
            "port": 26379
          }
        ],
        "name": "master"
      }
    },
    "memoryStorage": {
      "backend": "redis",
      "node": {
        "sentinels": [
          {
            "host": "sentinel1",
            "port": 26379
          },          {
            "host": "sentinel2",
            "port": 26379
          },          {
            "host": "sentinel3",
            "port": 26379
          }
         ],
        "name": "master"
      }
    }
}