Share MongoDB across 2 Docker containers having different MongoDB versions - mongodb

Already a fully-fledged mongo v3.2 instance with data is running on a container.
I need to create a mongo v3.6 container instance with the same data as v3.2.
I do not have space to clone the data on the server.
I tried a lot of stuff.
Can I point to the data of the v3.2 from my v3.6 so that it is shared and I save space?

You can try this. Don't know if it would work(because of different versions of mongodb).
You can create a sharded cluster and add your old DB as a shard.

I got the space cleared.
Got the dump and made a new instance of mongo.
It works like a charm now.
The sharing volume was corrupting the data.

Related

migrate the MMAPv1 generated data to WiredTiger

I am running a (keystonejs) webapp using mongodb 3.0 as database. I cloned the webapp and run a second instance using a 3.2 mongodb release (on a generated but yet empty data base). What I need to do now is get the data from the first database to the second. Since mongodb 3.2 uses a different default storage engine which is WiredTiger the clone uses that one. However the original app uses MMAPv1. Is there a easy way to migrate data create by MMAPv1 to WiredTiger?
Create a backup of the database on your old server using mongodump, restore it back to the new one using mongorestore, done. It's covered quite well in the documentation.
https://docs.mongodb.org/manual/tutorial/change-standalone-wiredtiger/
You can create replica set and add new machine to it. Doing so, you'll have latest data on newer server. Once replication is over, switch new machine to primary and shutdown old server if you want. This way you can easily clone your existing data to wiredTiger without loosing data or negatively effecting existing application.

Meteor - unmount existing mongo collection

We are creating Meteor-based Mongo database manager and we need the ability to "unmount" (remove from system) all collections when we switch databases.
Example:
I'm managing database called dbA. We have all collections for that database created using Mongo.Collection() on server and on client side.
I want to switch database to dbB. I need to unmount all Collections of dbA and mount those of dbB. Reason: dbB could have a collection of the same name as dbA (and usually does)
Is there a way to do this?
Thanks!
You may be able to accomplish this by publishing the necessary data from the new database.
Here's a discussion from a similar question on the Meteor Forums (note the proposed solution at the end):
https://forums.meteor.com/t/switch-database-while-meteor-is-running/4361/5
hi i think you can do with
db.copyDatabase()
run the shell command in the backend from meteor server and execute the copy database command. and after the database is copied you can remove the previous collection.
more detail about copyDatabase() is here
https://docs.mongodb.org/manual/reference/method/db.copyDatabase/

Where to set mongodb start parameter in a meteor application on nitrous.io?

I'm studying meteor and trying some examples on nitrous.io, but the available disk space was soon consumed by the big mongo data files (including the prealloc journal files).
Unfortunately MongoDB is also new to me. I googled around and found that I can start mongoDB with some parameters like --nojournal, but I have no idea where in the nitrous.io app I can pass this parameter to mongodb at startup?
I also can't find any mongodb.conf (even *db.conf) to use the storage.smallFiles setting.
Any help would be appreciated!
Instead of using Meteor's builtin MongoDB instance, you can specify a custom instance (which you can configure the way you want).
To do this Nitrous.IO, you can follow these steps:
Create a box with Meteor template.
Install MongoDB, by running parts install mongodb (Autoparts is Nitrous.IO specific package manager)
Open the MongoDB config located at /home/action/.parts/etc/mongodb.conf
Tweak it to your liking.
Start MongoDB instance by running parts start mongodb
Now you can create a new meteor project - meteor create projectname
Finally, when you're starting meteor on your project specify the MONGO_URL environment variable. eg: MONGO_URL=mongodb://0.0.0.0:27017 meteor.
Hope this would be good enough to get started. You can also upgrade your Nitrous.IO account to increase the storage of your box.
UPDATE: I just noticed that Meteor runs its MongoDB instance with --smallfiles flag set.

Meteor.js persistent + memory Mongo

It's possible to connect meteor manually to 2 or more databases in order to have a normal mongo that saves to the disk and a memory one like redis?
I'm asking because mongo has already full support from meteor and using it would be a lot easier than redis or other database
Right now, a Meteor server can only connect to one (and exactly one) Mongo database.
Redis support is on the roadmap, as is SQL support. Once Meteor supports multiple databases, you will have more options for how to set up your databases as well as dividing up your data between them. The only way to do what you are saying right now is to have your Meteor client connect to two different Meteor servers, and have one of them clear/dump the database regularly.
Source: discussions at Meteor's offices.

can I use MongoDb in server-less mode?

I'm considering using MongoDb for a backing store for a WPF app that I'm building. Mostly just to get some exposure to NoSQL. Ideally I'd like to make a mongodb database, put it in my application's root folder (or ./data) and connect to it with LINQ -- without having mongo.exe running. I did something similar recently with SQLite and found it to be a great change from XML for data storage.
Is this possible with MongoDb? All the samples that I've seen require mongod.exe to be running when you connect to the database. And the data is always stored in c:\data\db.
Answer, yes. Need to use the --dbpath switch and version 1.5.2 (for "upsert").