Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
Fix replication. keydb 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiarchitect committed Mar 2, 2020
1 parent 94bdfd2 commit c1ac1ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion keydb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: keydb
description: A Helm chart for KeyDB multimaster setup
type: application
version: 0.3.1
version: 0.4.0
keywords:
- keydb
- redis
Expand Down
13 changes: 8 additions & 5 deletions keydb/templates/cm-utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@ metadata:
data:
server.sh: |
#!/bin/bash
set -euxo pipefail
host="$(hostname)"
port="6379"
replicas=()
for node in {0..{{ (sub (.Values.nodes | int) 1) }}}; do
if [ "$(hostname)" != "{{ template "keydb.fullname" . }}-${node}" ]; then
replicas+=(--replicaof {{ template "keydb.fullname" . }}-${node}.{{ template "keydb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local "$port")
if [ "$host" != "{{ template "keydb.fullname" . }}-${node}" ]; then
replicas+=("--replicaof {{ template "keydb.fullname" . }}-${node}.{{ template "keydb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local ${port}")
fi
done
keydb-server /etc/keydb/redis.conf \
--active-replica yes \
--multi-master yes \
--appendonly {{ .Values.appendonly }} \
--bind 0.0.0.0 \
--port "$port" \
--protected-mode no \
--server-threads {{ .Values.threads | int }} \
"${replicas[@]}" \
{{- if .Values.password }}
--masterauth {{ .Values.password }} \
--requirepass {{ .Values.password }} \
{{- end }}
--active-replica yes \
--multi-master yes
"${replicas[@]}"

0 comments on commit c1ac1ca

Please sign in to comment.