Redis replica migration.

This commit is contained in:
Samuel Clay 2024-02-19 17:43:45 -05:00
parent 4b219cadca
commit c0b17d9e11
3 changed files with 9 additions and 5 deletions

View file

@ -6,9 +6,13 @@
- ../env_vars/base.yml
tasks:
- name: Extract part of hostname to determine container name
set_fact:
redis_role: "{{ inventory_hostname.split('-')[2] }}"
- name: Turning off secondary for redis by deleting redis_replica.conf
copy:
dest: /srv/newsblur/docker/redis/redis_replica.conf
dest: "/srv/newsblur/docker/redis/redis_{{ redis_role }}_replica.conf"
content: ""
tags:
- never

View file

@ -58,9 +58,9 @@
when: redis_secondary
- name: Remove redis_replica.conf file if not secondary
file:
path: "/srv/newsblur/docker/redis/redis_{{ redis_role }}_replica.conf"
state: absent
copy:
dest: "/srv/newsblur/docker/redis/redis_{{ redis_role }}_replica.conf"
content: ""
when: not redis_secondary
- name: Create Redis docker volume directory

View file

@ -27,7 +27,7 @@ aps -l hdb-redis-user-1,hdb-redis-user-2 -t redis
aps -l hdb-redis-session-1,hdb-redis-session-2 -t redis
aps -l hdb-redis-story-1,hdb-redis-story-2 -t redis
aps -l hdb-redis-pubsub -t redis
# Go into each redis and `SLAVEOF NO ONE`
apd -l hdb-redis-user-1,hdb-redis-session-1,hdb-redis-story-1,hdb-redis-pubsub -t replicaofnoone
# Elasticsearch