KeyDB icon indicating copy to clipboard operation
KeyDB copied to clipboard

Need to deploy Keydb:3.6.6 as active-active pod in kubernetes

Open vsomwanshi opened this issue 1 year ago • 1 comments

What issue we are facing;

By following this documentation page Active Replication, We have three keydb pods running in my OpenShift cluster with version 3.6.6, but I am not sure which one is the primary, seems any one can be.

Upon accessing the pods and they shows or gives the different value for same-key.

So, this page just supports active-active or master-slave only when the docker containers running on separate nodes or two separate docker container running on same system ? or when the pods are running in two different clusters ?

I have referred few of the documents where they have provided the steps which we can follow to setup the active-active multisite setup https://medium.com/@kedarnath93/keydb-active-active-replication-in-a-multi-site-kubernetes-environment-ff20f7bf9b45.

In our case, what we are searching for is ;

  1. we need to deploy keydb as statefulset, volume attached with 3 pods --- > We have statefulset, configmap ready.
  2. These 3 pods should be in active-active setup and data or values should match in each pod, if any pod goes down it should not impact on our application.

I tried to pass this below argument which will set the replicaof for master node and vice versa but not working as expected.

# Set replica to point to the other pod dynamically
            replica_host="keydb-1.keydb-service.$POD_NAMESPACE.svc.cluster.local";
            if [ "$(hostname)" = "keydb-1" ]; then
              replica_host="keydb-0.keydb-service.$POD_NAMESPACE.svc.cluster.local";
            fi;
            keydb-server /etc/keydb/keydb.conf \
              --bind 0.0.0.0 \
              --port 6379 \
              --active-replica yes \
              --tls-cert-file /etc/ssl/certs/keydb/keydb.crt \
              --tls-key-file /etc/ssl/certs/keydb/keydb.key \
              --tls-ca-cert-file /etc/ssl/certs/keydb/ca.crt \
              --replicaof $replica_host 6379

Even, we tried to run the commands post deployment of pods but still it is not showing the expected value in pods.

vsomwanshi avatar Oct 08 '24 08:10 vsomwanshi