net start MongoDB - system error - node.js

I am new to MEAN development which means I am new to MongoDB.
I have picked up Packt's book "MEAN Web Development" by Amos Haviv and I am running into issues right off the bat.
I have installed MongoDB no problems. I can run it just fine with "mongod" or by running the bin\mongod.exe command.
The problem is that the book has been telling me to do the following (and apparently the book is great so I doubt it would have gotten much acclaim if everyone got stumped like me so early on).
echo logpath = C:\mongodb\log\mongo.log > C:\mongodb\mongod.cfg
Cool, good, done. Config file is written and all is well.
Then it tells me to run this command
sc.exe create MongoDB binPath= "\"C:\mongodb\bin\mongod.exe\" --service --config= \"C:\mongodb\mongod.cfg\"" DisplayName= "MongoDB 2.6" start= "auto"
Again, runs fine. It gives me this message
[SC] CreateService Success
Then the author goes on to tell me that I should be able to run the following command.
net start MongoDB
Of which, mind you, I still do not really know what it's supposed to do. Is it the same as running
C:\>mongod
and
C:\mongodb\bin>mongod.exe
??
So, I try to run the command it suggests and I get the following:
System error 2 has occurred.
The system cannot find the file specified.
I have tried this solution already
MongoDB 3.0 Windows Service Start : System Error 2 has occured
But it doesn't seem to apply to me.
Please help. My knowledge of this stuff is quite limited (I am moving from mainly a PHP/JQuery background into this stuff and the initial setup is driving me crazy.
Any and all help is appreciate. Thanks all
B
EDIT - SOLUTION
Cannot start MongoDB as a service
This solution allowed me to fix my problem. I first had to uninstall the service that was supposedly successfully installed and then reinstall it using the command from this solution
mongod --logpath c:\mongodb\logs\mongo.log --dbpath c:\mongodb\data\db --directoryperdb --install

SOLUTION
Cannot start MongoDB as a service
This solution allowed me to fix my problem. I first had to uninstall the service that was supposedly successfully installed and then reinstall it using the command from this solution mongod --logpath c:\mongodb\logs\mongo.log --dbpath c:\mongodb\data\db --directoryperdb --install

Try running cmd as administrator it worked for me

Related

Why is my mongo db not starting? (Bitnami MEAN Stack)

I installed the stack on my laptop and it was working fine. Then I restarted my computer and tried to start mongo and it would not start.
the error message I get in the manager is
meanstack-3.0.6-1/mongodb/scripts/ctl.sh : mongodb could not be
started Stderr: child process exited abnormally
And when I try to start manually from a terminal I get an error saying data/db directory not found even though there is one.
I have already tried these steps with no luck:
1) Remove .lock file
sudo rm /var/lib/mongodb/mongod.lock
2) repair the mongodb
mongod –repair
3) start the mongodb
sudo service mongodb start
4) start the mongo client
just a tip: check your available free disc space, sometimes this kind of problems occurs because mongDb don't have enough space on the disc to run the server. if this is not working then manually check the log file Mongodb.log at 'yourPath\bitnami\meanstack-3.x.x-x\mongodb\log' hear you will sure find some proper clue.
Rename below file to anything
meanstack-3.0.6-1/mongodb/data/db/mongod.lock
restart mongodb from bitnami
note:-- mongodb installed in your system is different then installed through bitnami, they are using different ports, i.e. currently you have two instance of mongodb installed in your system.
I needed to install an old version of Mongo so I replaced all the files in the /bin folder with the old version and then I was getting the error "mongodb could not be started". I then deleted all the files under data/db and restarted using "./ctlscript.sh start mongodb" which worked.

Error with Mongo starting Meteor

I am using a fresh Linux install. I am trying to install Meteor. Using Ubuntu 12.04, Centos and Ubuntu 13.04. I installed Node.js, Meteor and Meteorite.
Error:
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start mongod
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.
I've tried:
Deleting .meteor/local/db/mongod.lock
Also I tried to change the permissions for the whole project with chmod.
Do you recommend any Ubuntu distribution?
Thanks in advance.
I have run in this problem before (after meteor update or abnormal meteor termination) and these solutions worked for me before.
Restart your machine.
Delete the file .meteor/local/db/mongod.lock and run meteor again.
Execute meteor reset and start again, but this command will erase your database.
Hope it helps.
It some time depends on your locale settings.
Meteor reset and delete mongod.lock didn't help in my case.
I've fixed it by running
export LC_ALL=C
you can add this line to
sudo vim /usr/local/bin/meteor
All I had to do was run "killall mongod" in the terminal. After that it worked again. I believe it may have cleared parts of the database though.
For me a combination of the suggestions worked out. The answer that has gotten 2 down votes! and this one from another page.
sudo vim /usr/local/bin/meteor
export LC_ALL="en_US.UTF-8"
then make sure which port your mongodb is running at by issuing the following:
meteor mongo
You will get a response like this:
connecting to: 127.0.0.1:3001/meteor
now that you know the port on which the mongo is configured, add the following to the same file we have been editing:
export MONGO_URL=mongodb://127.0.0.1:3001/meteor
Now you are good to go. Of course "meteor reset" works but if you dont want to loose your data, stick with those two export lines.
I have found that setting MONGO_URL helps avoid issue
export MONGO_URL=mongodb://localhost:27017/your_db
If you're having this issue running Ubuntu inside Vagrant/VirtualBox, then the problem come from working in the synced vagrant folder.
The workaround is to initialize the .meteor directory in the home directory and to mount it in the synced folder. Assuming your meteor app is called MyApp and the /vagrant is the synced folder, here's how to do it:
cd ~
meteor create MyApp
cd MyApp
meteor
cd /vagrant/MyApp
sudo mount --bind ~/MyApp/.meteor/ .meteor
meteor
I had a similar issue. It was due to the fact that my project directory was part of my Dropbox and there was some conflicted files in the .meteor/local/db directory. Removing these solved the problem.
I encounter the same issue when my disk space ran low.
Freeing up some space in the disk fixed the problem for me.
I encountered this problem when I ran meteor in VMWare, ubuntu 14.04 guest on a Windows 7 host. The problem was that I was running meteor/mongo in a shared directory. When I used a non-shared directory (~/meteor/project) the problem disappeared.
Following the steps that #Oscar mentions further up should sort you out.
However in my case meteor reset wouldn't work, telling me this:
reset: Meteor is running.
This command does not work while Meteor is running your application. Exit the running Meteor development server.
For which I tracked the process down, like this:
$ ps aux | grep meteor --color=auto
which gave me this info:
$ myUser 71981 0.5 0.0 2849208 3644 ?? S Mon02pm 4:25.27 /Users/myUser/.meteor/packages/meteor-tool/.1.1.10.1b51q9m++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/mongodb/bin/mongod --bind_ip 127.0.0.1 --smallfiles --port 2001 --dbpath /Users/jgt/Documents/Projects/todos/.meteor/local/db --oplogSize 8 --replSet meteor
As you can see I'm on Mac, but this works fine on any Unix based OS.
So then you only need to kill the process by it's id, like this:
$ kill -9 71981
And finally run again meteor reset
That's it, got it working now. Hope it helps.
One option is to wait until you have your app on a staging or production server, and then test it on an Android emulator provided by Android Studio or BlueStacks.
I am having this issue on WSL for Ubuntu on Windows. The only solution that worked for me was creating a remote mongodb with mLabs and ran the following
export MONGO_URL=mongodb://username:password#randomurl.mlab.com:port#/project
Recently I got the same case, which I run meteor on WSL for Ubuntu on windows 10. I resolved this case by updating WSL to version 2.
Note :
Make sure your Windows build is higher than the minimum WSL 2 requirements. And don't forget to set version 2 as WSL default version after updating.
wsl --set-version [linux_dist] 2
For windows 10, I moved all my Meteor projects in drive C. So far working.

Cloud9 on Raspberry Pi, Unable to save files

I'm trying to get the cloud9 local server working on my Raspberry Pi(512mb model B, running raspbian).
I followed this installation guide:
http://www.slickstreamer.info/2013/02/how-to-install-cloud-9-on-raspberry-pi.html
After this installation everything appeared to be working properly, I can start the server with the following command:
~/cloud9/bin/cloud9.sh -l 0.0.0.0 -w ~/Documents/www/workspace/
when I start the server all the files in the workspace are displayed properly and I can view, duplicate, delete, and create files remotely no problem. But when I edit an existing file and try to save it remotely a little spinning wheel pops up on the tab of the file I'm saving and it continues to spin endlessly.
When I start the server a warning pops up saying: 'path.existsSync is now called fs.existsSync.' I'm not sure if that is relevant or not.
I found another thread somewhere saying that I should go through cloud9/configs/default.js and replace any instance of localhost with 0.0.0.0. I tried that, but it didn't fix my problem.
Does anyone have any suggestions about how to get cloud9 saving files properly?
Thanks in advance for your help.
There were several complains about IDE file saving hangs on cloud9 support. At the bottom of the page there is a solution you can try.
I fully removed cloud9 and node(followed these directions to remove node: Uninstall Node.JS using Linux command line?), and then did a clean install following these directions: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=30265. In addition to those commands I also had to run the following:
sudo npm install formidable
sudo npm install gnu-tools
sudo npm install xmldom
after that I was able to start the cloud9 server without issue, and now I'm able to save files.
thanks for trying to help

Creating MongoDB Start-up script

I have been struggling on creating mongodb start-up script.
I have this file here "script.js" that contain my scripts that i want to execute every-time the server boot.
My script file is under "/opt/temp/script.js"
db.getCollectionNames().forEach(function(collection) {
print(collection);
});
Which command should I write to execute this file every time after the sever restarted ?
Where to put that command ?
Please help me
Thanks you..
What version of Linux are you using, what version of MongoDB have you installed, and how did you install it?
If, for example, you installed Mongodb on Ubuntu as per the MongoDB Docs you should have a start up script in /etc/init.d/mongod which will auto-start MongoD on boot.
If you have installed, say, a release candidate in a non standard location, I found these scripts to be fairly good and very alterable.
Using this script will NOT guarantee mongod starting on boot. You'll need to use sysv-rc-conf to set the run-levels correctly, like the apache2 line in the image linked.
Hi I managed to get it working I created Script.jsfile with my mongoDb commands and place it at /op/myscripts. Then on the mongodb-confI included the command to execute my script once mongodb is started command mongo /opt/myscripts/script.js.

getting error when starting xampp with error missing job name

I installed xampp in ubuntu 12.04 and everything is ok but when i am trying start it from terminal i get this error:
start: missing job name
try 'start --help' for more information.
JOB is the name of the job that is to be started, this may be followed by zero
or more environment variables to be defined in the new job. This is the information which i got from help but is my first experience with linux. all tutorials on the web tells that all the things that i need to do is just enter start...
What to do?
Thanx
When you follow this guide: http://www.apachefriends.org/en/xampp-linux.html#378
and run command:
/opt/lampp/lampp start
Or, you run some other command?(in question is not specified what you have executed). If so, most likely something is not correctly installed...
Also you should provide xampp version, how the software was installed (rpm, compiled,....)

Resources