14 Mayıs 2019 Salı

Mongodb Change secondary priority(avoid becoming primary)




Hi,

You may have mongodb replica set and also you may want to set ones to avoid becoming primary.

For example we have 1 replica set. 1 primary(Roma),1 local secondary(Roma) and 1 remote secondary(Milano). If there is a problem with primary Roma or Milano may be primary after elections.But we want that Milano site is disaster site and it shouldn't be in elections.

For this request,our need to set priority to 0



1)cfg = rs.conf()

2)cfg.members[2].priority = 0

3) rs.reconfig(cfg)



Attention:

cfg.members[2].priority------------------>We set 2nd member priority,it may be different in your replica set


MongoDB is pretty:)

Hiç yorum yok:

Yorum Gönder