Instances Redis Sentinel
This commit is contained in:
parent
6bffaefe04
commit
122e0a51d4
|
@ -280,12 +280,69 @@ Depuis redis 2.6 (2.4 en Wheezy), par défaut, le slave est en read-only, on peu
|
|||
slave-read-only off
|
||||
~~~
|
||||
|
||||
### Sentinel
|
||||
## Sentinel
|
||||
|
||||
Sentinel permet de faire du failover avec des slaves Redis.
|
||||
Attention, il est encore en développement. Il est donc dans la branche instable du dépôt de redis.
|
||||
Par ememple, une instance master redis1 et un slave redis2. En cas de panne les rôles s'échangent, redis2 devient master et redis1 devient le slave.
|
||||
|
||||
### Instances Sentinel
|
||||
|
||||
Si l'on veut superviser plusieurs réplication Redis différentes depuis un même serveur, il est possible de faire fonctionner plusieurs instances de Redis Sentinel ; chacune avec sa propre configuration et son propre utilisateur.
|
||||
|
||||
#### Template systemd
|
||||
|
||||
Créer le template d’unité systemd suivant dans /etc/systemd/system/sentinel@.service :
|
||||
|
||||
~~~
|
||||
[Unit]
|
||||
Description=Advanced key-value store (monitoring)
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/bin/mkdir -m 0755 -p /run/redis/%i
|
||||
ExecStartPre=/bin/chown redis-%i: /run/redis/%i
|
||||
PermissionsStartOnly=yes
|
||||
|
||||
Type=simple
|
||||
PIDFile=/run/redis/%i/sentinel.pid
|
||||
ExecStart=/usr/bin/redis-sentinel /etc/redis/sentinel-%i.conf --unixsocket /run/redis/%i/sentinel.sock --pidfile /run/redis/%i/sentinel.pid
|
||||
ExecStop=/usr/bin/redis-cli -s /run/redis/%i/sentinel.sock shutdown
|
||||
Restart=always
|
||||
User=redis-%i
|
||||
Group=redis-%i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
~~~
|
||||
|
||||
#### Installation
|
||||
|
||||
Créer un utilisateur système pour l’instance :
|
||||
|
||||
~~~
|
||||
useradd --system --home-dir=/tmp redis-replication1
|
||||
~~~
|
||||
|
||||
Créer ensuite le fichier de configuration suivant dans /etc/redis/sentinel-replication1.conf :
|
||||
|
||||
~~~
|
||||
port 16379
|
||||
dir "/tmp"
|
||||
sentinel monitor replication1 127.0.0.1 6379 1
|
||||
sentinel down-after-milliseconds 1000
|
||||
sentinel config-epoch replication1 7
|
||||
sentinel leader-epoch replication1 8
|
||||
sentinel known-slave replication1 127.0.0.1 6380
|
||||
sentinel current-epoch 8
|
||||
~~~
|
||||
|
||||
Sentinel doit pouvoir ecrire dans son fichier de configuration :
|
||||
|
||||
~~~
|
||||
chown redis-replication1: /etc/redis/sentinel-replication1.conf
|
||||
~~~
|
||||
|
||||
## Benchmarks
|
||||
|
||||
<http://redis.io/topics/benchmarks>
|
||||
|
|
Loading…
Reference in a new issue