-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Is is possible to define the replicaSet priorities for each host?
The problem I have is that the host that runs the rs.initiate() command often does not become the Primary instance in the set. So running rs.reconfig() fails.
Ideally it would be great to define it as part of mongodb_conf_replSet
The playbook I'm running...
- hosts: localhost
vars_files:
- ./variables.yml
roles:
- { role: Stouts.mongodb }
vars:
mongodb_version: "3.2.12"
mongodb_conf_auth: no
mongodb_conf_dbpath: /data/db
mongodb_conf_port: 27017
mongodb_conf_bind_ip: 0.0.0.0
mongodb_conf_replSet: rs0/{{ replicaSecondHost }}:27017,{{ replicaThirdHost }}:27017
mongodb_shell:
local:
- rs.initiate()
- cfg = rs.conf()
- cfg.members[2].priority = 0
- rs.reconfig(cfg)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels