Can you set replsets to less than 3

Hi,

We are attemtping to deploy mongodb on a aws eks cluster using this operator.

I noticed that even if i modify the params it will always create at minimum 3 replicasets.

psmdb-db.values.yaml

replsets:
  - name: rs0
    size: 1

is it possible to have size 1?


When setting it to 1 it seems to always create 4 (0-3)

 kubectl get pods -n mongodb                                                                                        khan: Thu Apr 20 14:18:02 2023

NAME                              READY   STATUS    RESTARTS   AGE
psmdb-db-rs0-0                    2/2     Running   0          100s
psmdb-db-rs0-1                    2/2     Running   0          75s
psmdb-db-rs0-2                    2/2     Running   0          55s
psmdb-db-rs0-3                    2/2     Running   0          37s
psmdb-db-rs0-arbiter-0            1/1     Running   0          100s
psmdb-operator-584fc857f8-s2f4t   1/1     Running   0          69m

Hi @Kay_Khan !

If you want to set less than 3 you will have to specify allowUnsafeConfigurations: true option.
You can check the description of the option on this page: Custom Resource options - Percona Operator for MongoDB

thank you! much appreciated

Just a follow up as i think its related, after spinning up a single replica. I can see in the logs of the pod that i get the following error:

kubectl logs -f psmdb-db-rs0-0 -n mongodb

{“t”:{“$date”:“2023-04-20T13:34:46.606+00:00”},“s”:“E”, “c”:“REPL”, “id”:21420, “ctx”:“conn644”,“msg”:“replSetReconfig error while validating new config”,“attr”:{“error”:{“code”:2,“codeName”:“BadValue”,“errmsg”:“Replica set configuration must contain at least one non-arbiter member with priority > 0”},“newConfig”:{“_id”:“rs0”,“version”:16,“term”:5,“members”:[{“_id”:0,“host”:“psmdb-db-rs0-0.psmdb-db-rs0.mongodb.svc.cluster.local:27017”,“arbiterOnly”:false,“buildIndexes”:true,“hidden”:false,“priority”:0,“tags”:{“podName”:“psmdb-db-rs0-0”,“serviceName”:“psmdb-db”},“secondaryDelaySecs”:0,“votes”:0},{“_id”:4,“host”:“psmdb-db-rs0-arbiter-0.psmdb-db-rs0.mongodb.svc.cluster.local:27017”,“arbiterOnly”:true,“buildIndexes”:true,“hidden”:false,“priority”:0,“tags”:{},“secondaryDelaySecs”:0,“votes”:1}],“protocolVersion”:1,“writeConcernMajorityJournalDefault”:true,“settings”:{“chainingAllowed”:true,“heartbeatIntervalMillis”:2000,“heartbeatTimeoutSecs”:10,“electionTimeoutMillis”:10000,“catchUpTimeoutMillis”:-1,“catchUpTakeoverDelayMillis”:30000,“getLastErrorModes”:{},“getLastErrorDefaults”:{“w”:1,“wtimeout”:0},“replicaSetId”:{“$oid”:“644131f88edfa9769a039f56”}}},“oldConfig”:{“_id”:“rs0”,“version”:15,“term”:5,“members”:[{“_id”:0,“host”:“psmdb-db-rs0-0.psmdb-db-rs0.mongodb.svc.cluster.local:27017”,“arbiterOnly”:false,“buildIndexes”:true,“hidden”:false,“priority”:2,“tags”:{“serviceName”:“psmdb-db”,“podName”:“psmdb-db-rs0-0”},“secondaryDelaySecs”:0,“votes”:1},{“_id”:4,“host”:“psmdb-db-rs0-arbiter-0.psmdb-db-rs0.mongodb.svc.cluster.local:27017”,“arbiterOnly”:true,“buildIndexes”:true,“hidden”:false,“priority”:0,“tags”:{},“secondaryDelaySecs”:0,“votes”:1}],“protocolVersion”:1,“writeConcernMajorityJournalDefault”:true,“settings”:{“chainingAllowed”:true,“heartbeatIntervalMillis”:2000,“heartbeatTimeoutSecs”:10,“electionTimeoutMillis”:10000,“catchUpTimeoutMillis”:-1,“catchUpTakeoverDelayMillis”:30000,“getLastErrorModes”:{},“getLastErrorDefaults”:{“w”:1,“wtimeout”:0},“replicaSetId”:{“$oid”:“644131f88edfa9769a039f56”}}}}}

kubectl get pods -n mongodb                 
NAME                              READY   STATUS    RESTARTS   AGE
psmdb-db-rs0-0                    2/2     Running   0          8m48s
psmdb-db-rs0-arbiter-0            1/1     Running   0          8m48s
psmdb-operator-584fc857f8-s2f4t   1/1     Running   0          88m

Is this suggesting that i need to change/set the priority of this single node?

Can you please try to disable arbiter since for 1 node I don’t see the purpose and it is possibly making a problem. Arbiter is usually used in a setup like 2 data nodes + 1 arbiter or 4 data nodes + 1 arbiter to save resources but still be able to have normal elections and prevent network split.