Mongo DB freezes during --config or --dbpath - mongodb

(I am a Windows user)
I recently installed the MongoDB application onto a remote HDD. I have installed Mongo DB before on my Laptop's SDD and it worked perfectly. I am encountering an issue with the mongod --config "PATH to cfg file" command and the mongod --dbpath "PATH to database". When I run either command, the program halts (I can still close the Command Prompt window though). I am trying to change the database path because right now it defaults to C:/data/db even though Mongo is installed on a foreign Disk Drive. I have tried running both commands as a System Administrator to no avail. Any ideas as to I can solve this issue?

Related

How to start Mongo DB server from Windows?

I have installed MongoDB 3.6.3 on my Window 8.1(64 bit) machine. I have created the path data/db too but when I tried to start mongodb using the command 'C:\Program Files\MongoDB\Server\3.6\bin', it is not starting. It showing a message "the program can't start because api-ms-win-crt-convert-l1-1-0.dll is missing from your computer". Anyone help me to start Mongo DB server. Thanks in advance.
Open CMD
nevigate to C:\Program Files\MongoDB\Server\3.6\bin [Your mongodb installed location]
Then run command as mongod --dbpath E:\sangram\mongo_workspace --port 27017
[E:\sangram\mongo_workspace] is my local directory where i'll store my mongodb data

Mongo is unable to start

I'm trying to start mongo uin windows10 by type: mongo in cmd.
I am getting this error:
C:\Users\Itzik>mongo
MongoDB shell version v3.4.1
connecting to: mongodb://127.0.0.1:27017
2016-12-26T19:00:16.604+0200 W NETWORK [main] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2016-12-26T19:00:16.605+0200 E QUERY [main] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:234:13
#(connect):1:6
exception: connect failed
C:\Users\Itzik>
I have opened port 27017 in the firewall,
and restart mongo's services
and it still dont work.
what could it be?
Have you started the server? Mongodb follows a server-client architecture. mongo is the client, but before it is started you need to start mongod, which is the server.
If you haven't, start the server in advance in a different console:
mongod --dbpath "c:\data"
replacing c:\data by any folder where you want to store your data (you need to create the folder in advance).
If mongod is not in the path look in the installation path, it should be something like C:\mongodb\bin\mongod.exe.
When the server says something like 'waiting for connections', then you can go to another console and type mongo to start the client.
In C:\Program Files\MongoDB\ you might not have permission to create file/folder for your user. And mongo installer cannot create it because of lack of Administrative permission for your user.
So in C:\Program Files\MongoDB:
Create a folder named data
Create a folder named db inside the folder data
Now right click on the data folder and choose properties
Click security tab and select your user there
Click the Full control select box
Click ok, ok, ok ...
important! if you don't have the path "C:\Program Files\MongoDB\Server\3.4\bin" set in environment variable, please set it.
Now go to shell and type : mongod --dbpath "C:\Program Files\MongoDB\data\db"
That's it :)
First start the server.
Goto your installation path. Mine was in "Program Files/Mongodb/server/bin"
You will find a "mongod.exe" application.
However, the server will look for "C:/data" folder for all the databases.
So create the "C:/data" folder.
Now start the mongod.exe using command prompt.
>>mongod
After this you may start the client
>>mongo
This worked out for me.
Open the terminal as Administrator.
(You can simply do this by searching cmd in start and then right click and select "Run as administrator")
Go to bin directory of your MongoDB folder.
cd C:\Program Files\MongoDB\Server\3.4\bin
Type following command to start mongodb server :
mongod --dbpath "C:\Program Files\MongoDB\Server\3.4\bin\Data"
now, server will be waiting for connections.
Open a new command prompt(again as Administrator)
Go to bin directory.
cd C:\Program Files\MongoDB\Server\3.4\bin
Type following command:
mongo
This will show you a prompt of mongodb :
>
Thanks.
if u install by brew (on osx)
first run sudo mkdir /data/db
start mondoDB Daemon by typing mongod (leave it open) and then
run mongo by typing mongo in new terminal tab
I also have faced the same problem.
First i have typed mongodb in my command prompt ,It displays "waiting for connection on 27017" that means it is working.
Then i type mongo in another Command prompt Window then above error occurred.
I was having both .dll files in my xampp\php\ext folder.
(php_mongo.dll and php_mongodb.dll)
I deleted Php_mongodb.dll and also it's extension from php.ini file.
Again restart command prompt,Type mongod and then mongo
Now working correctly.
First set the path in Enviroment Variables, C:\Program Files\MongoDB\Server\3.6\bin
after that use bellow command
C:\>mkdir data
C:\>cd data
C:\data>mkdir db
C:\data\db>
Then go to bin directory and select mongod.exe or use mongod. Without closing previous cmd
open a new cmd and start the client using mongo
Now it will work.
This issue is resolved by creating a data directory
Then move to the bin folder of mongodb or setting path information in environment variables
Then you can enter the following command,
mongod --dbpath 'path of the data folder including data directory name'
Eg: mongod --dbpath c:\users\codemaker\data

Can not start MongoDB windows service on Windows 7

I have installed MongoDB 3.0.3 as a windows service on Windows 7 using below command
mongod --dbpath "E:\MongoDB\Data\db" --logpath "E:\MongoDB\Data\log\mongodb.log" --install --serviceName "MongoDB.3.0.3" --serviceDisplayName "MongoDB 3.0.3"
I can see the entry in services.msc. But when I start the service i get below error
I tried reinstalling it and even restarting the PC but nothing worked.
I got the solution.
The reason for this error was unclear shutdown of service(my PC got restarted abruptly dues to some windows update last day). this corrupts the database files.
So I deleted all the files from "E:\MongoDB\Data\db" folder and it worked.

mongodb instantly stopping after starting

A fairly simple question...
mongod in the command line just stopped working?
In the command line i start up mongod like i used to and it doesn't start and just goes straight back to the command line:
username:~ computer$ mongod
all output going to: /usr/local/var/log/mongodb/mongo.log
username:~ computer$
Tried in terminal mongod --repair and nothing happens... it just waits longer before going back to the normal username:~ computer$
Why is this broken now?... how do i figure out what went wrong? So confused.
I'm trying to uninstall mongodb and re-install... even that is hard... how to you uninstall it in terminal?
ER
This cmd seems to have fixed it:
$ mongod --repairpath arg
For start mongod you need parameter -dbpath -logpath mandatorily or configure all parameters in /etc/mongod.conf and run with root user
If you run mongo shell, in console typing mongo, not mongod, mongod launch mongo process, mongo is for access to shell.
If you need unistall mongo, only need delete all mongo files in /user/bin or path where unzipped the pack mongo

Mongod service won't start in OSX

I'm having trouble getting mongodb to run in OSX Mavericks.
I installed it using brew, but when I run mongod it tell me that output is going to usr/var... as normal then quits out to the terminal prompt with no errors. Any ideas what the problem could be?
I've tried removing the .conf file and reinstalling, I've checked nothing else is using the port. When I try and run it through the launchctl plist file it says the file doesn't exist.
Thanks,
Tom.
Create a folder somewhere in your drive and start it using
mongod --dbpath yourfolder --logpath myfile.log --logappend
.. and check the result.
I have several instances of mongo running in my Mac with Maverick OSX and it works perfectly.
I think it's the best way to test it. After that you can review what's going on with the config files.
If this works you can add --fork at the end to fork the process.