From bb31ed2d10f1876a50353abb258c2a5be13e2da2 Mon Sep 17 00:00:00 2001 From: "carey.xu" Date: Thu, 17 Dec 2015 18:16:12 +0800 Subject: deploy mongodb as cluster for HA JIRA: COMPASS-207 Change-Id: I1069bcc2d0dd97dd6a4c7bb61351be993d86b33a Signed-off-by: carey.xu --- deploy/adapters/ansible/roles/database/templates/mongodb.conf | 3 ++- deploy/adapters/ansible/roles/database/templates/replica.js | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 deploy/adapters/ansible/roles/database/templates/replica.js (limited to 'deploy/adapters/ansible/roles/database/templates') 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); -- cgit 1.2.3-korg