|
|
|
If you want to quickly set up a local `MongoDB` Cluster without installing `Mongo` directly on your system, I've found just setting up a Docker Container is a great option, I'll explain below how to setup a local instance of a `MongoDB` Cluster using a Docker Container:
|
|
|
|
|
|
|
|
# Seting up the Container
|
|
|
|
|
|
|
|
## 1. Install Docker
|
|
|
|
|
|
|
|
1st you're gonna need to have docker installed. You can install Docker by following the instructions for your operating system:
|
|
|
|
|
|
|
|
* [Mac OS](https://docs.docker.com/desktop/setup/install/mac-install/)
|
|
|
|
* [Windows](https://docs.docker.com/desktop/setup/install/windows-install/)
|
|
|
|
* [Linux](https://docs.docker.com/engine/install/ubuntu/)
|
|
|
|
|
|
|
|
After installation, double check Docker is running by testing:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker --version
|
|
|
|
```
|
|
|
|
|
|
|
|
## 2. Pull the `MongoDB` Docker Image
|
|
|
|
|
|
|
|
To start MongoDB instances, first pull the official MongoDB Docker image:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker pull mongo:latest
|
|
|
|
```
|
|
|
|
|
|
|
|
## 3. Initialise the Replica Set
|
|
|
|
|
|
|
|
Once the container is up and running, you'll need to start the replica set:
|
|
|
|
|
|
|
|
* Nav to the containers shell
|
|
|
|
* Initiate the replica set `rs.initiate()`
|
|
|
|
* Check it's working as expected `rs.status()`
|
|
|
|
|
|
|
|
## 4. Connect to the MongoDB Cluster
|
|
|
|
|
|
|
|
Now you've got your cluster up and running. You can connect to the cluster using **MongoDB Compass** or **Robo 3T**, provided you have either installed if not feel free to just access it through the backend after setting up the `CONNECTION_URI` in `.env` or install from [here](#Installing-MongoDB-Compass-or-Robo-3T).
|
|
|
|
|
|
|
|
# Installing MongoDB Compass or Robo 3T
|
|
|
|
|
|
|
|
**MongoDB Compass** and **Robo 3T** are two popular interface tools for working with `MongoDB` databases, follow the links below to download either
|
|
|
|
|
|
|
|
* [**MongoDB Compass**](https://www.mongodb.com/products/compass) is MongoDB's official interface for interacting with your databases. It provides easy access to collections, indexes, and documents.
|
|
|
|
* [**Robo 3T**](https://robomongo.org/) is a free, open-source `MongoDB` GUI tool that allows you to connect to your `MongoDB` databases, execute queries, and manage your documents easily - a bit out of date but still a classic.
|
|
|
|
|
|
|
|
#### |
|
|
|
\ No newline at end of file |