What if data folder already exists on root C - mongodb

When installing MongoDB I have a server that already has a folder named data. IS the an alternate naming convention I can use for MongoDB?
Thanks!

Before starting the mongod server, you can define the path of where is your "data" folder located. So, you can create another one either in C: or anywhere else.
Look at the documentation here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ under the section Start MongoDB Community Edition from the Command Interpreter
You can also set up a configuration file so you don't have to manually tell mongod where is the path every time its started. This info is also in the link, under Start MongoDB Community Edition as a Windows Service

Related

Where is the MongoDB Data?

This is more of a general question about how MongoDB works.
But I've been using MongoDB for a while and everything seems to be working for me. The part that currently confuses me, though, is that when I visit the directory where the MongoDB data is saved (I'm using the default data/db) the directory is empty. The data is being persisted, I'm just confused - why does the directory appears empty on my computer?
I'm on Windows, if that's worth anything.
You can execute :
db.serverCmdLineOpts().parsed.storage.dbPath
from inside the mongo process and find what the dbPath startup parameter show to find where your data is saved
or alternatively check from the config file in windows:
<install directory>/bin/mongod.cfg
dbPath can be confusing.
When you run mongod without --dbpath option or unset it in config file then it defaults to \data\db
However, when you use the default config files which comes along the installation then the dpPath is different (I don't remember by heart which). So you should really check path with db.serverCmdLineOpts() as suggested by R2D2
I know, for Linux the default dbPath is /data/db but the pre-installed config file /etc/mongod.conf has set /var/lib/mongo

Unable to connect apostrophe-cms with mongodb v3.4.7

I am new to mongodb and apostrophe-cms. I installed mongodb v3.4.7 (64bit) and apostrophe-cms (apostrophe-cli#2.1.3) successfully on my Window Server.
I created a apostrophe project with many pages and the website is up and running on my http://localhost:8080.
Now, the problem is: I see ony static content written in my xxx.html files located in
lib\modules\apostrophe-pages\views\pages
I do not get any content from the mongodb which is filled with aposAttachments and aposDocs etc. It is important to mention that the mongodb is not the original database. I copied a database from another apostrophe project and renamed it according to the current apostrophe project name.
Is that a valid thing to do, or an absolutely no-go area? Where do I tell apostrophe which database to use?

Missing mongodb.conf on FreeBSD 10.2

After having installed MongoDB 2.6.12 for FreeBSD 10.2, I need to change some MongoDB configuration parameters but there seems to be a problem.
there is no mongodb.conf file in the directory /etc/
instead, I located a mongodb.conf under usr/local/etc/ but the file is empty!?
I don't get it, what is wrong? MongoDB installation routine did not prompt any errors, hence I was expecting a fully operational mongodb.conf under /etc/
How am I supposed to change the MongoDB configuration now? Simply add the desired entries to the existing file under usr/local/etc/?
The correct location is /usr/local/etc/mongodb.conf, and the file is supposed to be empty. All you need is to add something like dbpath=/usr/data/db (or wherever you have created the directory to host your database) to be able to start the server.

Mongo error on I control hotfix

I have tried to start mongod.exe from my 2008 R2 server and im getting this error:
I CONTROL Hotfix kb2731284 or a later update is not installed, will zero-out files.
I didnt find any update or what is I CONTROL, someone have encounter with the problem?
Thank you.
Well, I just faced the same issue. I installed the fix, but saw nothing but same error. So that's how I got over it: just create a folder structure in your C catalog like this one: C:\data\db. So it worked for me perfectly. I use Windows 7 x64.
I had to run the command in following format & it worked for me:
C:\mongodb\bin\mongod.exe --dbpath d:\test\mongodb\data
Ref: Original documentation link
In my case the problem was that I had a space in my data path: E:\Program Files\MongoDB\Data\
I ran dir /x within E:\ to get the short path for Program Files and used the short path instead: mongod.exe --dbpath E:\PROGRA~1\MongoDB\Data\
It worked. Shocking that spaces in paths are still an issue!
The above error comes when mongodb not found the directory like "C:\data\db" which is by default when you install mongodb on your machine.
So just go to c drive create a directory like "data\db" and now run the command "mongodb.exe".
If you want to relocate the database location to any other drive say D drive in that case create a directory like "D:\mongodb\data" and run the command like "mongodb.exe --dbpath d:\mongodb\data".
I got the similar error
I CONTROL Hotfix kb2731284 or a later update is installed, will zero-out files.
Notice the message says later update is installed not later update is not installed in my case. But It was not starting the server.
Creating a different folder structure for the db Drive\<mongo-db-folder>\<yourdb>and providing it with --dbpath flag while running the mongod worked for me. The short name for Program Files PROGRA~1 didn't work for me. Maybe this has something to do with the rights managment.
This known issue is in Windows 7. In Windows 8 this problem haven't appeared yet.
Firstly I would recommend to change your mongo installation path to path with folders names without gaps. For example, default mongo installation path is C:\program files\bla-bla... to avoid a wasting of time for looking for solutions of this issue, change your path to C:\mongo.. and make sure that you haven't names with gaps in your path.
After that install this hot-fix.
Another thing I suggest you to do: Create folder data\db in disc C.
You could also change your mongo work path each time you use mongo shell, but it's overwork by my modest opinion.
I've done these steps and my mongo has started to work.
Getting started on mongodb was not that difficult. Well I have been facing similar error on mongodb to start.
I have getting error
Services
Windows could not start the MongoDB on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 100.
OK
very simple way to overcome.
Solution is the Mongodb service has not been started
to do so. Open CMD in admin mode and type NET START "Mongodb" > This will start the service.
Inspite of this if services is not getting started or mongo.exe is not starting. It is coz your mongodb has locked the file. Mongodb is shared file system and it gets locked. You need to for mongo.lock file in your created dir. Delete the file and start the service. You should be able to start now.
Cheers
By just creating a folder structure like below in my "C:\" drive , i resolved the issue :=>
c:\data\db
Sometime it works without creating the above mentioned folder structure, i.e. MONGODB itself creates the same (as it worked for me in Windows 8 laptop) but sometimes it needs to be explicitly done (as i need to for my windows 7 installed desktop)
Also you can browse through the complete installation and connection process for MONGODB.
Similiar to above, but I had a typo in my mongodb.cfg file which meant that Mongo couldn't find the data directory on startup. Fixed the typo and Mongo starts. Given the previous response I suspect that the failure to start is more of an issue over finding the data directory than the Hotfix message
If you had got the below error message::
2015-05-29T05:05:54.207+0530 I CONTROL Hotfix KB2731284 or later update is not
installed, will zero-out data files
2015-05-29T05:05:54.219+0530 I STORAGE [initandlisten] exception in initAndLis
en: 29 Data directory D:\data\db\ not found., terminating
2015-05-29T05:05:54.219+0530 I CONTROL [initandlisten] dbexit: rc: 100
then just create a directory "D:\data\db\""
then restart the mongod
it should work fine
you need to have mongod.exe running in one cmd window. then use another cmd window, write mongo and hit enter
You need to create the C:\Data\Db directory if you don't specify an existing directory when you run mongod.exe.
This directory is the default one.
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/
You can do fix [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating by following given two steps.
You can create the D:\data\db\ directory and restart the MongoDB server.
You can create the data folder as per your choice and run the server with the path of your data folder and restart the MongoDB server
i.e. D:\MongoDB\Server\3.0\bin>mongod.exe --dbpath D:\MongoDB\Server\data​
I just deleted mongod.lock in my db directory, and now it works fine.
1 : Download and install the fix from here :
http://hotfixv4.microsoft.com/Windows%207/Windows%20Server2008%20R2%20SP1/sp2/Fix405791/7600/free/451413_intl_x64_zip.exe
them reboot windows
2 : this you should make a folder called "data" and within it another one called "db"
c:/data/db ;
I would start with the second step , it's most likely to solve The problem .
As for what "I CONTROL" means, the "I" is for "Information" (we have W for warning and E for error) and CONTROL is the component writing that log/message (we have also NETWORK, WRITE, QUERY and COMMAND components).
So you could get also I COMMAND ..., I QUERY ..., I WRITE ... :)
Well, that is a common problem when you shut down your machine and mongodb server is running, it is pretty clear that MongoDb has created a lock in your db folder.
Just go to c:\data\db and remove MONGOD.LOCK
Run Mongo and it will work again.

ideal vm setup for meteor with shared folder

situation
Hello, I run arch Linux for which there is no meteor package and have an Ubuntu server run within virtualbox for web development. There is a shared folder I mount through database. hich means I can code in to the active environment.
However, like many others, I have a problem with mongodb starting up, specifically the exit code 100.
tracing the problem:
I created the /data/DB directory
gave access rights to my user
ran mongod on its own with no problems
Still I have the issue though.
Question
Where is the configuration file for mongodb which is installed with meteor so I can move it and do I need to create rights for a 'mongodb' user?
Question
What would be the ideal virtual machine for running a meteor development environment in the above set up? Having to create the data directory in the first place tells me Ubuntu server isn't ideal. some extra documentation available to answer this second question appearing on the meteor website would be beautiful
MongoDB does not work correctly on virtualbox shared folders. By default, meteor creates a mongo database in your project's directory, however you can override this behavior with the MONGO_URL environment variable. If you set this variable, meteor will not try to start mongo and will instead connect directly to the mongo endpoint you specify. This allows you to setup mongo however you like (eg using the Ubuntu mongodb package), with data somewhere not in the shared folder.