MongoDB server not starting from vs code terminal - mongodb

I am a beginner of MERN and while learning Mongodb I used to open my server using my PowerShell by the command mongod but I got to know that I can do the same from my VS code terminal. But unfortunately, it is not starting the server for some reason. There is no error that it prints on the screen. It simply prints some data and doesn't start the server. It is running mongo command perfectly on my terminal. Can anyone tell me why it is starting?

The error got fixed. Actually my project was in D drive and my data folder was into my C drive so whenever I was opening the terminal using mongod command. It used to find the data folder and as it didn't used to find it on D drive. It therefore used to close it up at the same time. Though if it would have shown the error correctly then it would have been better to fix it up.
I used cd C: command to change into the C: drive and then used the command mongod

Related

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.

synchronizing history when ipython notebook and console are connected to the same kernel

I have ipython notebook running on a remote server, i.e.
ipython notebook --profile=nbserver
which I access from my local machine. Further, I ssh to the remote server from my machine, and start ipython console (terminal) on that server. I have found following command to work well:
ipython console --existing \
~/.config/ipython/profile_nbserver/security/kernel-*.json
Now I am connected to the same remote kernel from two different clients (lets call them browser and terminal). Everything works well, except one annoying detail:
1) in browser, I type a=1
2) in terminal, I type b=2
3) in both clients I can see both commands using %history. But when I want to cycle through the history (in terminal) using Up, it only shows the commands which have been typed in the terminal, (i.e b=2). Similarly, I am unable to use a + PageDown in the terminal, to go back in history and find the command starting with a.
From what I understand, my two clients are using two separate history files history.sqlite. But why does %history show all commands ?
Question:
Is there any way to configure using one history.sqlite for both clients ?
I find, having easy access to history is absolutely crucial. Moreover, I see using both terminal and browser as complementary, they both have tradeoffs and are best used combined.
You can set where the history gets loaded either by setting it at the terminal:
ipython --HistoryManager.hist_file=$HOME/ipython_hist.sqlite
or within the ipython config files:
import os
c.HistoryManager.hist_file=os.path.expanduser("~/ipython_hist.sqlite")

Can't run "meteor mongo" on Meteor in Windows (latest meteor for windows exe bootstrapper)

I am trying to run a meteor app for the first time on Windows( using Windows 7 in particular). I am able to successfully run the app but i can't seem to be able to run the command meteor mongo in a separate command prompt window. The following error pops up:
mongo: Meteor isn't running.
This command only works while Meteor is locally. Start your
application first.
I have already tried meteor reset. How can i fix this?
I think there is possible a misconception about what the meteor mongo command does.
It only connects to the mongo instance of a running meteor development process.
So you need to start the meteor app by changing to your app's directory and running 'meteor'. Then on a different console window, change you the same directory and run 'meteor mongo'.
In the image below, when meteor isn't running I get the error you get, but you will note that it says that you have to start your application first. If you do that, and then in another console window it works:
Try one of these admin UIs for mongo instead. They connect directly to the db, so should overcome whatever problem there is with command line.
Alternatively, you may try a non-standard command line utility, like Cygwin.

windows 8 mongodb locked file, bad shut down

I just got mongo running yesterday, I entered C:\mongodb\bin\mongod.exe, then bought up another command prompt and entered the same thing again, and it was working fine. I ended up shutting it down wrong and now im getting unable to create/open lock file: data/db/mongod/lock because it is being used by another process. I have tried all of what im seeing but getting not recognized errors. It was a little test db, so i want to just get rid of it so i can open mongo again. I deleted the file.lock from my db file as well, but not sure it worked seems like it left and was back again, but it might just be me.
I know this is a super easy problem, just not getting it. Where should i be entering these command, im following the instructions, but i know im not inputing them in the right place because none of them work at all. I tried just inputting them, in C, in C: data/db, i entered C:\mongodb\bin\mongod.exe left it open and opened another command prompt and enter everything in there to. I can't just reset mongodb? Does anyone know what I'm missing maybe it's i have no windows knowledge at all, i'm trying to use it because i know javascript a little php/sql and i'm trying to learn node.js when i had it working in the shell it was great, but with this set up stuff i'm lost. I'm understanding everything there saying but just not where to do it i think.
Someone please lol, i just uninstalled mongodb and reinstalled and same problem.
mongod --repair (is not recognized as internal, or external command)
db.repairDatabase(same,,is not recognized as internal, or external command);
\data\db\mongod.lock (asks how i want to open it)
This is my set up, i think mongod is the problem, but can't get rid of it.
Computer>Windows>data>db
_tmp
joural
local
local.ns
mongod locked file
edit*** not sure if i removed the lock or not but i got it to work. I should have wrote down how i did it but pretty sure this was it.
open a command prompt cd\ enter it cd mongodb\bin enter it open another command cd\ enter it cd mongoDb\bin enter it. in the first command enter mongod then in the other one enter mongo. Don't know if this is right way, but i got me to be able to play with mongodb like i wanted.
try to remove mongod.lock and journal, then restart.

Cannot start MongoDB: System error 1067 in Windows

After setting up MongoDB service on Windows Server 2008 R2 this error was raised.
C:\mongodb\bin>net start MongoDB
The Mongo DB service is starting.
The Mongo DB service could not be started.
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
The error came from an unclean shutdown detected.
Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
a few steps will fix it (as it's written in the link above):
1) remove the file /data/db/mongod.lock
2) run mongod.exe --repair
3) start the mongod service net start MongoDB
For anyone who faced this error on 2020, with version 4.4.1 of mongo, and the accepted answer not solve the issue, here is what I've done:
Remove all mongo services from pc (add/remove programs).
Go to program files and backup the MongoDB folder.
Remove the MongoDB folder.
Re-install mongo db.
And it should work.
UPDATE for January 2021, the following saved me without re-installing MongoDB and losing all my data:
C:\Program Files\MongoDB\Server\4.4\bin>mongod --dbpath "C:\Program Files\MongoDB\Server\4.4\data" --repair
I was facing the same issue and I closed the other command prompt which was opened with mongoDB.exe, and hence created a lock on that executable. Simply only closing that command prompt window worked fine. Thanks for the help.
Make sure you have at least 5 Gb available space on the drive of the database. For me, clearing that space enabled the ability to restart Mongodb.
If you are in the Windows. you should change the mongodb's config in the System disk.For example
1) I change C:\Windows\system32\mongodb.exe.
2) And I make the path in D:\mongodb\mongod.cfg .Before this,you should remove previous.
3) Finally , you can net the serve. net start mongodb.
I hope it can help you .English is not very good ,please forgive me.
enter image description here
I was having the problem of starting the the MongoDB. The logs are pretty descriptive and you can find suggestion from there.
There is a 'd' folder that needs to be created within data folder like
data\d which was missing.
This solved my problem.
Although, not an ideal solution, I ended up deleting all of the database files in \data\db and was then able to successfully run the MongoDB service. Note, this will delete all of the data in the database.