summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database/templates
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/database/templates')
-rw-r--r--deploy/adapters/ansible/roles/database/templates/replica.js2
-rw-r--r--deploy/adapters/ansible/roles/database/templates/wsrep.cnf4
2 files changed, 5 insertions, 1 deletions
diff --git a/deploy/adapters/ansible/roles/database/templates/replica.js b/deploy/adapters/ansible/roles/database/templates/replica.js
index 3282cd6a..d19db50d 100644
--- a/deploy/adapters/ansible/roles/database/templates/replica.js
+++ b/deploy/adapters/ansible/roles/database/templates/replica.js
@@ -1,7 +1,7 @@
config = { _id:"compass", members:[
{% for host in haproxy_hosts.values() %}
{% set pair = '%s:27017' % host %}
- {_id:{{ loop.index0 }},host:"{{ pair }}"},
+ {_id:{{ loop.index0 }},host:"{{ pair }}",priority:{{ haproxy_hosts|length - loop.index0 }}},
{% endfor %}
]
};
diff --git a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
index 643792ab..4dc6fb7b 100644
--- a/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
+++ b/deploy/adapters/ansible/roles/database/templates/wsrep.cnf
@@ -23,7 +23,11 @@ wsrep_provider_options="gcache.size=1024M"
wsrep_cluster_name="my_wsrep_cluster"
# Group communication system handle
+{% if haproxy_hosts|length == 1 %}
+wsrep_cluster_address=gcomm://
+{% else %}
wsrep_cluster_address=gcomm://{{ haproxy_hosts.values()|join(",") }}
+{% endif %}
# Human-readable node name (non-unique). Hostname by default.
#wsrep_node_name=