MongoDB (ServerService) not installing on windows10 - mongodb

I am trying to install mongodb on my windows10 computer, but keep getting error that I don't have the privileges, even though I am the admin user.
I tried running the msi installer getting the error. So I tried the commands shown in the docs https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows-unattended/#procedure using the terminal running as admin, but getting the same error as seen below.
I am trying to install it on my D:/ Drive. But I also tried installing it in the default C:/Program Files/MongoDB/Server/4.4/ but it didn't work as well.
cmd: msiexec.exe /l*v mdbinstall.log /qb /i mongodb-windows-x86_64-4.4.3-signed.msi INSTALLLOCATION="D:\Program_Files\MongoDB\Server\4.4\" ADDLOCAL="ServerService,Client,Router,MiscellaneousTools" SHOULD_INSTALL_COMPASS="0"

The log on as a service user right allows accounts to start or run services on a Windows machine. By default, and due to security reasons, services can only be configured to run under the Local System, Local Service or Network Service accounts which have a built-in right to log on as a service. Any other user account that requires to run a service must be assigned this right.
Run gpedit.msc.
Navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies >User Rights Assignment.
In the details pane, double-click Log on as a service.
Click Add User or Group and add the account to the list of accounts that have the Log on as a service right. Once you have selected the user, click OK.
Click OK and close the policy editor.
References :
https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/log-on-as-a-service

No matter what I tried, I just couldn't get the Server Service to install on my system through the msi, using either the gui or command line.
So finally I installed it without checking the "Install MongoD as a Service" option.
It successfully installed the mongodb including the mongod.exe in the bin (finally).
Then ->
Set the environment variables PATH to my bin folder
Create the /data/db and /log/mongo.log in the directory you want
Type the command mongod --directoryperdb --dbpath <your_dir_path>\data\db --logpath <your_dir_path>\log\mongo.log --install
Type the command net start MongoDB
And you will have the mongodb service running as I did.

Related

mongodb installation. service failed to start

Installing MongoDB as a service is failing for me. The install gets to the point where it tries to start the service and then fails:
Service 'MongoDB Server' (MongoDB) failed to start. Verify that you have sufficient privileges to start system services
This in on a freshly updated new install of Windows 2016
Near default MongoDB 4.2 community install.
Install MongodB as a Service
- Run service as Network Service user.
Directories are not default.
Data Directory : C:\Database\Data
Log Directory : C:\Database\Log
I've granted Network Service full permissions on C:\Database
.net framework 4.6 is installed.
Am I the first person to install MongoDB as a service or something?
Hard to believe someone didn't catch this before.
Update:
Installing to the default directories works. Brutal QA. Any fix to this?
Well, in case someone else comes across this...
One solution is to just install to the default directories, then after the install is done, stop the service, change the cfg to point to the directories you want and copy the files over. Then start it up.
Check path of the MongoDB service by runninng Win+R, type services.msc in opened window find MongoDB server double click it. Here what I see when installed MongoDB to custom folder C:\mongodb MongoDB server path
You probably need to install it into default folder or change path to executable in services.
In latter case run Win+R type there regedit.exe go to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MongoDB and change ImagePath key.
In my case key was "C:\Program Files\MongoDB\Server\4.2\bin\mongod.exe" --config "C:\Program Files\MongoDB\Server\4.2\bin\mongod.cfg" --service
and I changed it into "C:\mongodb\bin\mongod.exe" --config "C:\mongodb\bin\mongod.cfg" --service
restart

How to stop mongodb server on startup in Mac?

I recently installed MongoDB Community Edition on macOS. The manual says to use brew services start mongodb-community#4.0 to start the server.
When I want to shutdown the server, I enter mongo shell and type use admin and then type db.shutdownServer(). But when I reboot the computer, the server is auto started. How do I prevent it from auto starting at reboot in MacOS?
Your computer can have multiple LaunchAgents folders.
My homebrew.mxcl.mongodb-community.plist file was under:
/Users/YOUR-USERNAME/Library/LaunchAgents/
Deleting it should solve this issue. After that a manual start is needed.
To prevent mongo from autoload on Mac just delete or move this file: ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
Source: https://gist.github.com/subfuzion/9630872

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

Deployd :: Failed To Start MongoDB

Am a newbie in Deployd and MongoDB. I have installed Deployd (www.deployd.com) 0.6.9 on my Windows-XP system. I executed the following command at the prompt as instructed by the book am studying
>dpd create sportsstore
Now, when i run the following command
> dpd –p 5500 sportsstore/app.dpd
to start the Deployd server, i get the following error::
starting deployd v0.6.9...
Failed to start MongoDB
It states that MongoDb has failed to start. I went into the directory "C:\Program Files\Deployd\tools" and found that there is a file called "mongod".
I have never installed MongoDB before on my computer. It is my first time working with Deployd so i don't know whether the "Mongod" file in the tools folder is the same as MongoDB or i have to install MongoDB separately on the computer.
Can someone point me to the right direction.
Thanks.
First of all, you have to install mongodb in your computer. You can do it from the official site for MongoDB. The standard option would be to install the Community version.
After that, you can check if mongodb was properly installed and can be used with Deployd:
If you are in iOS or Linux you can try:
sudo dpd
If you are in Windows try opening a command window with "Run as Administrator" and try:
dpd
For Windows Installation.
1) Run npm install deployd -g
2) Install Mongo DB separatetly using windows installer available on
https://www.mongodb.com/download-center#community
and configure to run it as service as mentioned on below url.
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/
Service option is convenient to start and stop database using net start and net stop command
3) create a deployd module using 'dpd create abcd'.
4) navigate to deployd module you have created (using cd abcd) to run dpd -d command. Before you run dpd -d command you need to ensure the you start the mongodb service from same command prompt running in elevated mode or admin mode.( use the command : 'net start MongoDB')
In case It is still giving path error then try below command:
set path=%PATH%; "C:\Program Files\MongoDB\Server\3.4.1\bin"
this command is alternative for setting path in environment variable (in case user doesn't have permissions to modify environment variable)
Still not working, same path issue ??
run using command --mongod as mentioned below
dpd -m "C:\Program Files\MongoDB\Server\3.4.1\bin\mongod.exe"
After installed the depolyd run:
dpd -e production
To solve the problem of "failed to start mongoDB"
1- I installed mongoDB for windows from this web page (https://docs.mongodb.com/manual/installation/).
2- Then I created a path as shown below
path
3 - I installed the deployd and I run:
dpd -e production

install mongodb on window 8

I try to install mongodb on window 8 .
problem is when i want to install mongodb service
C:\mongodb\bin\mongod.exe --auth --config C:\mongodb\mongod.cfg --install
below error accord
Wed Mar 13 19:13:23 Trying to install Windows service 'MongoDB'
Wed Mar 13 19:13:23 Error connecting to the Service Control Manager: Access is denied. (5)
how Can I Install Mongodb Service?
Open Command with "Run as Administrator",that solved my problem
For anyone that happens to try to create a mongodb service on Windows 8 and follows the instructions on MongoDB's website AND still is unable to create the service successfully - I've written this post that explains how I got it to work after experiencing problems trying to set the mongo service on my Windows 8 laptop. Hope it helps!
Here are the steps that you really need to follow to create a Windows service for MongoDB in Windows 8:
Installing MongoDB on Windows 8
Download and install MongoDB. You can download the 32 or 64-bit version from here.
Make sure you install MongoDB in a folder that you can easily remember, for example: c:\mongodb\
Add directories c:\mongodb\log and c:\mongodb\data
Add log file c:\mongodb\log\mongo.log
Creating a Windows service for MongoDB
Open your command window and type the following:
cd c:\mongodb\bin\mongod.exe --install --rest -master -logpath=c:\mongodb\log\mongo.log
Open the registry settings, press the Windows key and R at the same time and then type regedit in the Run command window.
Go to HKEY_LOCAL_MACHINE >> SYSTEM >> CurrentControlSet >> services
Find out MongoDB directory & edit ImagePath key
Set key value as:
C:\mongodb\bin\mongod --service --rest --master --logpath=C:\mongodb\logs\mongo.log --dbpath=C:\mongodb\data
Save and exit registry editor.
Open Services by pressing the Windows key and R at the same time and then type services.msc in the Run command window and click OK.
Find the MongoDB service and right-click on it, select Properties
Make sure the service is set to start automatically and start the service as shown below.
Open your browser and go to http://localhost:28017/ to see if MongoDB is running correctly, you should see a page full of MongoDB details.
Link to this blog post:
http://ricardodsanchez.com/2014/09/03/install-mongodb-service-on-windows-8/
error message suggest you don't have admin privileges.
"Run all of the following commands in Command Prompt with “Administrative Privileges:”"
Ref: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/#install-and-run-the-mongodb-service
Regards,
Moacy
thanks for answer Moacy Barros but problem was not for this because i run all commands in Command Prompt with “Administrative Privileges:”" problem was for mongod.cfg if mongod.cfg config by manual in editor this problem solve that we didn't need to do this in window 7 or server 2008
Edit::
in older windows when installing MongoDB < 2.2 that i was tested. in Configure directories and files step
echo logpath="C:\Program Files\MongoDB\log\mongo.log" > "C:\Program Files\MongoDB\mongod.cfg"
it make mongod.cfg for your mongodb but it wasn't make for me in window 8 for that i make it by manual like
logpath=C:\mongodb\log\mongo.log
logappend=true
dbpath = E:\data