Sentinel don't need instance
This commit is contained in:
parent
122e0a51d4
commit
280d88d620
|
@ -280,19 +280,15 @@ Depuis redis 2.6 (2.4 en Wheezy), par défaut, le slave est en read-only, on peu
|
||||||
slave-read-only off
|
slave-read-only off
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## Sentinel
|
### Sentinel
|
||||||
|
|
||||||
Sentinel permet de faire du failover avec des slaves Redis.
|
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.
|
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.
|
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
|
#### Unite systemd
|
||||||
|
|
||||||
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.
|
Créer l’unité systemd suivant dans /etc/systemd/system/redis-sentinel.service :
|
||||||
|
|
||||||
#### Template systemd
|
|
||||||
|
|
||||||
Créer le template d’unité systemd suivant dans /etc/systemd/system/sentinel@.service :
|
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
[Unit]
|
[Unit]
|
||||||
|
@ -300,31 +296,19 @@ Description=Advanced key-value store (monitoring)
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/bin/mkdir -m 0755 -p /run/redis/%i
|
|
||||||
ExecStartPre=/bin/chown redis-%i: /run/redis/%i
|
|
||||||
PermissionsStartOnly=yes
|
|
||||||
|
|
||||||
Type=simple
|
Type=simple
|
||||||
PIDFile=/run/redis/%i/sentinel.pid
|
PIDFile=/run/redis/sentinel.pid
|
||||||
ExecStart=/usr/bin/redis-sentinel /etc/redis/sentinel-%i.conf --unixsocket /run/redis/%i/sentinel.sock --pidfile /run/redis/%i/sentinel.pid
|
ExecStart=/usr/bin/redis-sentinel /etc/redis/sentinel.conf --unixsocket /run/redis/sentinel.sock --pidfile /run/redis/sentinel.pid
|
||||||
ExecStop=/usr/bin/redis-cli -s /run/redis/%i/sentinel.sock shutdown
|
ExecStop=/usr/bin/redis-cli -s /run/redis/sentinel.sock shutdown
|
||||||
Restart=always
|
Restart=always
|
||||||
User=redis-%i
|
User=redis
|
||||||
Group=redis-%i
|
Group=redis
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
#### Installation
|
Créer ensuite le fichier de configuration suivant dans /etc/redis/sentinel.conf :
|
||||||
|
|
||||||
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
|
port 16379
|
||||||
|
@ -340,7 +324,7 @@ sentinel current-epoch 8
|
||||||
Sentinel doit pouvoir ecrire dans son fichier de configuration :
|
Sentinel doit pouvoir ecrire dans son fichier de configuration :
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
chown redis-replication1: /etc/redis/sentinel-replication1.conf
|
chown redis: /etc/redis/sentinel.conf
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## Benchmarks
|
## Benchmarks
|
||||||
|
|
Loading…
Reference in a new issue