![]() Inside mongo shell access the admin database. Using the Admin role you can create db users and assign them roles on individual databases. For the scope of this article let us stick to two important roles - Admin and DB user. You can create users and assign them different roles and different levels of access to databases. Like all other databases, MongoDB has a built in support for access control. Setup database users and assign them roles Once your EC2 instance is setup, ssh into the instance and install MongoDB. Which means for 16 GB of stored data your server needs to have atleast 2GB RAM. A simple calculation that works out for us is that for every 16 GB of data in the DB we allocate 1GB of RAM for WiredTiger because of the way our data is structured. Setup a new EC2 instanceīefore doing this take into account your database size and number of indexes in order to decide an optimum disk space and RAM for your instance. With that out of the way, let’s get to setting things up. Please note that even though at Ithaka we use a Linux distro on top of EC2 instances, the points mentioned in this article are generic enough to work on most cloud+OS combinations. Open up the network port to connect to MongoDB.Enable MongoDB auth to protect access to the database.Setup database users and assign them roles.This, along with the common understanding that it is never a good idea to run your database service on the same server instance as your production services, makes it clear that you need to establish remote MongoDB server/s which your services then connect to. You can read more about how and why in their manual. To be specific it will take either 50% of (RAM minus 1GB) OR 256 MB, whichever is higher. If you have used MongoDB you probably already know that starting from version 3.4 MongoDB’s WiredTiger Storage engine takes up a considerable amount of RAM. At Ithaka quite a few of our microservices use MongoDB 3.6 for data persistence.
0 Comments
Leave a Reply. |