Shared Hosting for Everyone, imagined by developers, for developers.
Discovering the Public CloudMongoDB is a document-oriented noSQL database program.
In our example, we use the SSH access and consider the following information:
foo
$HOME/mongodb/
[foo]
must be replaced by your account name.
foo@ssh:~$ mkdir mongodb
foo@ssh:~$ cd mongodb
foo@ssh:~/mongodb$ wget -O- https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian12-8.0.1.tgz | tar -xz --strip-components=1
foo@ssh:~/mongodb$ mkdir -p data log
Choose the package tgz and the platform Debian of the last version of the tarball.
Create a service with following details:
./bin/mongod --dbpath ./data/ --logpath ./log/mongo.log --ipv6 --bind_ip_all --port=27017
/home/[foo]/mongodb
Public Cloud users will need to point the service to a port between 8300 and 8499 instead of the default MongoDB port.
The address to connect to the MongoDB instance will be services-[foo].alwaysdata.net:[port]
.
Replace [port]
by the chosen port in the command.
Private Cloud users will need to open the port by creating a firewall rule if they want to access it from the external network:
Title | Value |
---|---|
Protocol | UDP/TCP |
Type | ACCEPT |
Direction | Input |
Hosts | <specify nothing> |
Ports | 27017 |
IP version | IPv4/IPv6 |
foo@ssh:~/mongodb$ wget -O- https://downloads.mongodb.com/compass/mongosh-2.3.2-linux-x64.tgz | tar -xz --strip-components=0
foo@ssh:~/mongodb$ mv mongosh-2.3.2-linux-x64/bin/* bin/
foo@ssh:~/mongodb$ rm -rf mongosh-2.3.2-linux-x64
foo@ssh:~/mongodb$ wget -O- https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian12-x86_64-100.10.0.tgz | tar -xz --strip-components=0
foo@ssh:~/mongodb$ mv mongodb-database-tools-debian12-x86_64-100.10.0/bin/* bin/
foo@ssh:~/mongodb$ rm -rf mongodb-database-tools-debian12-x86_64-100.10.0
All executables will then be located in $HOME/mongodb/bin
.
Here, we will create the admin user following their documentation.
foo@ssh: ~/mongodb$ ./bin/mongosh services-[foo].alwaysdata.net:[port]
Current Mongosh Log ID: 6707c8c098d8f59e6efe6910
Connecting to: mongodb://services-[foo].alwaysdata.net:[port]/?directConnection=true&appName=mongosh+2.3.2
Using MongoDB: 8.0.1
Using Mongosh: 2.3.2
------
test> use admin
switched to db admin
admin> db.createUser(
... {
... user: "admin",
... pwd: "mysuperpassword",
... roles: [
... { role: "userAdminAnyDatabase", db: "admin" },
... { role: "readWriteAnyDatabase", db: "admin" }
... ]
... }
... )
{ ok: 1 }
admin>
Replace mysuperpassword
by the password of your choice.
You can then add the --auth
option to the command for the service.