How to Install MongoDB Community Server on Azure/AWS
To install and setup MongoDB community server on an Azure VM or AWS EC2, the recommended way is to install using the image available in the cloud marketplaces maintained by Cloud Infrastructure Services. Deploy a MongoDB server running community edition on Ubuntu Server, Debian or CentOS Server. Self host your own MongoDB database server in the cloud.
Cloud MongoDB Server
Setup MongoDB Server on AWS
MongoDB Features Community Edition
MongoDB stores data in flexible, JSON-like documents, meaning fields can vary from document to document and data structure can be changed over time. Mongo DB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use.
MongoDB is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster.
- Stores data in flexible, JSON-like documents
- The document model maps to the objects in your application code, making data easy to work with
- Ad hoc queries, indexing, and real time aggregation provide powerful ways to access and analyze your data
- MongoDB is a distributed database at its core, so high availability, horizontal scaling, and geographic distribution are built in and easy to use
- Sophisticated security controls and advanced functionality to satisfy both new and existing privacy and compliance measures.
Getting Started with MongoDB
Once your MongoDB server has been deployed, the following links explain how to connect to a Linux VM:
Once connected and logged in, the following section explains how to start using MongoDB
Using MongoDB Community Server
MongoDB uses the MongoDB shell depending what version of MongoDB you’re running to interact with MongoDB. Its part of the installation. The mongo shell or mongosh shell is an interactive JavaScript interface to MongoDB. You can use the mongo shell to query and update data as well as perform administrative operations also as a way for developers to test queries and operations directly with the database.
ulimit Considerations
Most Unix-like operating systems limit the system resources that a process may use. These limits may negatively impact MongoDB operation, and should be adjusted. See UNIX ulimit Settings for the recommended settings for your platform.
NOTE
Starting in MongoDB 4.4, a startup error is generated if the ulimit value for number of open files is under 64000.
Directories on Ubuntu/Debian
The data directory /var/lib/mongodb and the log directory /var/log/mongodb are created during the installation.
Directories on CentOS
The data directory /var/lib/mongo and the log directory /var/log/mongodb are created during the installation
By default, MongoDB runs using the mongodb user account. If you change the user that runs the MongoDB process, you must also modify the permission to the data and log directories to give this user access to these directories.
Configuration File
The official MongoDB package includes a configuration file (/etc/mongod.conf). These settings (such as the data directory and log directory specifications) take effect upon startup. That is, if you change the configuration file while the MongoDB instance is running, you must restart the instance for the changes to take effect.
Running MongoDB on Ubuntu/Debian: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#run-mongodb-community-edition
Running MongoDB on CentOS: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/#run-mongodb-community-edition
MongoDB Server Documentation
MongoDB Firewall Ports
MongoDB uses the following default TCP firewall ports:
Port 27017 – The default port for mongod and mongos instances. You can change this port with port or –port.
Port 27018 – The default port for mongod when running with –shardsvr command-line option or the shardsvr value for the clusterRole setting in a configuration file.
Port 27019 – The default port for mongod when running with –configsvr command-line option or the configsvr value for the clusterRole setting in a configuration file.
The links below explain how to modify / create firewall rules depending on which cloud platform you are using.
MongoDB on AWS
To setup AWS firewall rules refer to – AWS Security Groups
MongoDB on Azure
To setup Azure firewall rules refer to – Azure Network Security Groups
Related Posts:
- How to Install MongoDB on Ubuntu 20.04 (Community Edition Tutorial)
- How to Install MongoDB on CentOS 8 (Community Edition Tutorial)
- How to Install MongoDB on Debian 11 (Community Edition Tutorial)
- How to Install Docker MongoDB Container Using MongoDB Image
- Cassandra vs MongoDB - What's the Difference (Pros and Cons)
- How to Create MongoDB Cluster Multi-Node on Ubuntu 20.04 (Tutorial)