Skip to main content

MongoDB

Version: 6.0.4 | OS: Ubuntu 20.04

Overview

MongoDB is a powerful, flexible NoSQL database designed for high availability, scalability, and developer productivity. It stores data in JSON-like documents, making it ideal for modern application development.

Included Software

  • MongoDB - 6.0.4

Firewall & Access

PortServicePurpose
22SSH (rate limited)Secure server access
80HTTPWeb-based communication
443HTTPSSecure communication

Note: MongoDB (port 27017) is bound to 127.0.0.1 by default and not externally exposed.

Initial Deployment

During the deployment process:

  • MongoDB is installed and pre-configured
  • Bound to 127.0.0.1 for local access

You will be logged out with the message:

Please wait until the installation is completed....
Connection to $IPADDRESS closed.

Wait at least 2 minutes before logging back in.

Accessing the Instance

  1. Login to your instance:
ssh ubuntu@$IPADDRESS
  1. Switch to root:
sudo su -

Viewing MongoDB Status

To verify MongoDB status and connection:

mongosh --eval 'db.runCommand({ connectionStatus: 1 })'

Enabling Remote Access (Optional)

By default, MongoDB binds to localhost (127.0.0.1) only. To enable remote access:

  1. Edit the configuration file:
nano /etc/mongod.conf
  1. Locate the bindIp setting and update it:
net:
bindIp: 0.0.0.0
  1. Restart MongoDB:
systemctl restart mongod

Security Warning: Enabling remote access without authentication or firewall controls is insecure. Always configure IP restrictions and enable MongoDB authentication before production use.

Best Practices

  • Enable authentication and create database users
  • Backup data using mongodump
  • Monitor performance and storage with MongoDB tools
  • Keep the database and system updated
  • Use ufw or a cloud firewall to restrict port 27017 access

For assistance, contact Webberstop Cloud Support.