MongoDB migration from local host to a Linux server
First, you should capture the database file:
Find this directory on windows cmd:
C:\Program Files\MongoDB\Tools\100\bin
write the following in the cmd:
“mongoexport --db --collection --out
output.json”
find the database JSON file in that directory
Now you should export you database to the server directory:
scp -r /mnt/d/database.json
@:/home/...
Now you should import the mongodb database:
mongoimport --db --collection --file
Specifying storage for mongoDB server in fresh install on Azure
The reason why you see pricing is because it's neither added by Canonical
nor MongoDB
publishers. The golden image you shared is being offered by Cloud Infrastructure Services. They not only offer MongoDB CE images but also packer, docker compose etc., built on top of Opensource OS.
As you say both OS & Data disks will be provisioned using Premium SSDs. I wouldn't worry much about performance.
To cut down costs, I would propose below things.
- Create MongoDB image yourself by picking free version of Ubuntu/Centos or whatever. You can use packer or Azure Image Builder. I would setup automation to periodically build images with different versions of Mongo & Linux flavor & version them
- Provision VM, install MongoDB app on top of the VM & regularly patch, upgrade both linux & application packages
- If you have MongoDB server on-prem, you could create a snapshot of OS with MongoDB application packaged in it, convert it into vhd file & export the image onto Azure. You can follow documentation here
- If MongoDB offers golden images as private offers & you have existing license contract with them. Check out with MongoDB, register your subscription & you may be eligible to access their golden images on Azure appearing as "Private Offers". RedHat offers it's images to customers this way.
The image being offered on Azure doesn't make much financial sense. Let's assume you have 3 node cluster.
Pricing for using image is :: 0.025 euros per hour
per day it would be :: 24*0.025 = 0.6 euros
yearly cost could be :: 365*0.6 = 219 euros
combined cost for 3 nodes :: 219*3 = 657 euros
If you have multiple environments, multiple databases in different regions, cost just gets multiplied on & on.
Now, the choice is yours!
Install multiple versions of MongoDB on linux
To do that, you must have both versions of MongoDB available on your system.
For instance, let's say you have downloaded the 2.6 version binaries to /opt/mongo/26/
and the other version's at /opt/mongo/34/
, you could run both versions of the database daemon on different ports:
/opt/mongo/26/mongod --dbpath /data/26/ --port 27017
/opt/mongo/34/mongod --dbpath /data/34/ --port 28018
Accessing MongoDB from Windows & Mac Client Machines
I found the answer. @ShahNewasKhan is brilliant. See How to connect Robomongo to MongoDB
All you need to do is SSH to server and edit mongod.conf
file:
- uncomment
#port=27017
toport=27017
- comment
bind_ip=127.0.0.1
to#bind_ip=127.0.0.1
- restart mongodb via
service mongod restart
Then create a mongo connection via your server ip in the address field and 27017 in the port field
Hope this helps mongo newbies and start-ups like me :) Good luck.
Now I just need to figure out how to make this secure. My concern is that anyone who knows my server ip can hack into my MongoDB
Related Topics
How to Send a Sequence of at Commands to a Serial Port in Bash
Linux Script to Automate Ftp Operation
How to Run a Shell Script by Cron Job
Crontab Is Not Working on Amazon Ec2 Server
Why Does Perf Show That Sleep Takes All Cores
How to Find Out Why My Storage Space on Amazon Ec2 Is Full
What Is Preemption/What Is a Preemtible Kernel? What Is It Good For
Examining Berkeley Db Files from the Cli
A Light Solution to Convert Text to PDF in Linux
Simple Way to Convert Hh:Mm:Ss (Hours:Minutes:Seconds.Split Seconds) to Seconds
How to Get Cmake to Use the Default Compiler on System Path
Aslr Bits of Entropy of Mmap()
How to Use Stdin Twice from Pipe
Is Kernel Space Mapped into User Space on Linux X86
Embedding the Password in the Bash Script
Installed Go Binary Not Found in Path on Alpine Linux Docker
Can't Find Out Where Does a Node.Js App Running and Can't Kill It