Installation of MongoDB in GCP
Step 1: Firstly, you need SSH in the Ubuntu instance you have created. You can do this in many ways. One way is to use SSH from the browser option that GCP provides. From the command line, run the command below to import the GPG MongoDB public key:
wget -qO – https://www.mongodb.org/static/pgp/server-4.0.asc | sudo apt-key add –
Step 2: Create a file using this command:
echo “deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse” |
sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Finally, the installation of MongoDB begins using this command:
sudo apt-get update
Step 3: Installation of MongoDB:
sudo apt-get install -y mongodb-org
And then, you should have MongoDB installed. At this point, if MongoDB is installed but not running. Start MongoDB with this command:
sudo systemctl start mongod
Now you’ll want to take a moment to verify that MongoDB has been installed properly. To do this, You have to run this command:
sudo systemctl status mongod
If everything is well, you will have a screen like this:
How to Run MongoDB on Google Cloud Platform?
MongoDB, the most popular NoSQL database in the technical world, is not based on a table-like relational database structure but provides different mechanisms for storing and retrieving data. This storage format is called BSON (similar to JSON). The term “NoSQL” means “non-relational”. A relational database management system (RDBMS) is not the right choice when it comes to controlling big data by design because it is not horizontally expandable. If the database is running on a single server, it will reach a scaling limit. NoSQL databases are more expandable or adaptable. MongoDB is such a NoSQL database that scales by adding more and more servers and increases productivity with a flexible document model.
Contact Us