How do i add Arbiter for PSA set up

Hi MongoDB Community

I would like to implement PSA

so far i have this … it would create P and A

config = { _id: “rs1”, members:[{_id: 0, host: “localhost:27017”},{ _id: 1, host : “localhost:37017”}]}

how do i modify to add arbiter ?

{_id: 3, host: " ??? "}

Thanks

Hi @Alan_Tam,

Please don’t. :smiley:

Trust me. Do yourself a favor and don’t use an Arbiter. I already explained this at length (I just did it in a post like 3 minutes ago) in multiple posts in this forum. Arbiters are evil.

Basically Replica Sets (RS) are designed to make your cluster Highly Available (HA). It’s their ONE reason to exist. Arbiters take a bite in HA already as one node in your cluster can vote but can’t acknowledge write operations meaning that you cannot write with w=majority without loosing HA entirely (because in a PSA losing the P or the S will prevent you from writing to 2 nodes at least). This wouldn’t happen in a PSS standard RS setup.

But if you must, this is the syntax you are looking for:

rs.initiate({
      _id: "replicaTest",
      members: [
         { _id: 0, host: "127.0.0.1:27017" },
         { _id: 1, host: "127.0.0.1:27018" },
         { _id: 2, host: "127.0.0.1:27019", arbiterOnly:true }]});

Cheers,
Maxime.

1 Like