summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database/templates
diff options
context:
space:
mode:
authorcarey.xu <carey.xuhan@huawei.com>2015-12-17 18:16:12 +0800
committercarey.xu <carey.xuhan@huawei.com>2015-12-25 13:18:21 +0800
commitbb31ed2d10f1876a50353abb258c2a5be13e2da2 (patch)
tree7e716df5ccc99bb19b624ff41ffd77cc0e60fb10 /deploy/adapters/ansible/roles/database/templates
parent21e1b393c0fc7f52c831882b53454877f6942495 (diff)
deploy mongodb as cluster for HA
JIRA: COMPASS-207 Change-Id: I1069bcc2d0dd97dd6a4c7bb61351be993d86b33a Signed-off-by: carey.xu <carey.xuhan@huawei.com>
Diffstat (limited to 'deploy/adapters/ansible/roles/database/templates')
-rw-r--r--deploy/adapters/ansible/roles/database/templates/mongodb.conf3
-rw-r--r--deploy/adapters/ansible/roles/database/templates/replica.js8
2 files changed, 10 insertions, 1 deletions
diff --git a/deploy/adapters/ansible/roles/database/templates/mongodb.conf b/deploy/adapters/ansible/roles/database/templates/mongodb.conf
index 68b84d7a..18306154 100644
--- a/deploy/adapters/ansible/roles/database/templates/mongodb.conf
+++ b/deploy/adapters/ansible/roles/database/templates/mongodb.conf
@@ -1,4 +1,5 @@
# mongodb.conf
-bind_ip = {{ internal_vip.ip }}
+bind_ip = 0.0.0.0
+replSet = compass
port = 27017
smallfiles = true
diff --git a/deploy/adapters/ansible/roles/database/templates/replica.js b/deploy/adapters/ansible/roles/database/templates/replica.js
new file mode 100644
index 00000000..3282cd6a
--- /dev/null
+++ b/deploy/adapters/ansible/roles/database/templates/replica.js
@@ -0,0 +1,8 @@
+config = { _id:"compass", members:[
+{% for host in haproxy_hosts.values() %}
+{% set pair = '%s:27017' % host %}
+ {_id:{{ loop.index0 }},host:"{{ pair }}"},
+{% endfor %}
+]
+};
+rs.initiate(config);