From f887d772aba273c7e65f10bb8e0cc7adae9dc190 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Thu, 24 Jan 2019 00:35:26 +0000 Subject: [PATCH] Updated creating ec2 mongodb image from scratch (markdown) --- wiki/info/landscape/creating-ec2-mongodb-image-from-scratch.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wiki/info/landscape/creating-ec2-mongodb-image-from-scratch.md b/wiki/info/landscape/creating-ec2-mongodb-image-from-scratch.md index b1ca42997db..b47bb0d0f20 100644 --- a/wiki/info/landscape/creating-ec2-mongodb-image-from-scratch.md +++ b/wiki/info/landscape/creating-ec2-mongodb-image-from-scratch.md @@ -96,5 +96,7 @@ Then execute ``systemctl enable mongod.service`` to launch the MongoDB process a Connect to the MongoDB on that instance, then issue the command ``rs.initiate()`` in order to turn the instance into the "seed" of a replica set. You can then, for the time being, ``quit()`` the mongo shell. Re-connecting, e.g., with ``mongo "mongodb://localhost:27017/?replicaSet=live"``, will show the ``PRIMARY`` of the new replica set. +Connected to the PRIMARY using the ``mongo`` shell, a replica can be added using ``rs.add({host: "hostname:port"}). For additional options see [here](https://docs.mongodb.com/manual/reference/method/rs.add/). To add a hidden replica on ``dbserver.internal.sapsailing.com:10203``, use ``rs.add({host: "dbserver.internal.sapsailing.com:10203", buildIndexes: false, hidden: true, priority: 0})``. + TODO: automate the initialization and replica set extension using "Addition Details" in the instance; create a MongoDB script that is executed during start-up; if no replica set exists and no user detail specifies where the primary is, run ``rs.initiate()``. If a replica set already exists, leave things unchanged. If no replica set exists and in a user detail something like ``REPLICA_SET_NAME=...`` and ``REPLICA_SET_PRIMARY=...`` is provided, add the local node as a secondary to the primary / replica set specified.