Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed Global Initialization: BadValue logpath requires an absolute file path with windows services

I am getting this error constantly while i am trying to install mongod using a configuration file. So, I am looking at this tutorial on Pluralsight on mongodb. The person's programming environment going as smoothly as it can. However, i am encountering several problems. First of all, i am trying to setup a different logpath and database path.This is the basic layout of the conf file

dbpath=/Pluralsight/db
logpath=/Pluralsight/mongod.conf
verbose=vvvvv

My syntax:

c:\Program Files\MongoDB\Server\3.0\bin\mongod -f c:\Pluralsight\mongod.conf
//Trying to run mongod using a configuration file

When i press enter, i am supposed to get a message that says everything is being directed to this new logfile and a new database. I do not get any message. However, that did not stop it from creating a log file with information in the expected folder. Now, I proceed to install mongod as a service. This is when i type

   C:\Program Files\MongoDB\Server\3.0\bin\mongod -f c:\Pluralsight\mongod.conf --install
    //using the configuration file to install mongod as a service

I get an error:

Failed Global Initialization: BadValue logpath requires an absolute file path with windows services

I have no idea how to fix this!

like image 265
Anjil Dhamala Avatar asked Sep 17 '15 04:09

Anjil Dhamala


5 Answers

I was having the same problem with MongoDB's instructions because I was using relative path in the CLI for my mongo.cfg once I had navigated to the MongoDB bin:

mongod.exe --config mongod.cfg --install.

Instead I needed to specify the config file's absolute path:

mongod.exe --config "C:\Program Files\MongoDB\Server\3.0\bin\mongod.cfg" --install

like image 100
michaelhawkins Avatar answered Nov 13 '22 00:11

michaelhawkins


The error message spells out the problem. Your MongoDB confguration file has a relative path, not an absolute path.

Try setting the logpath as follows

logpath=c:/Pluralsight/mongod.log
like image 23
daveh Avatar answered Nov 12 '22 22:11

daveh


I got the same problem. After I read this doc, resolved.

https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows

  1. Open an Administrator command prompt.

Press the Win key, type cmd.exe, and press Ctrl + Shift + Enter to run the Command Prompt as Administrator.

Execute the remaining steps from the Administrator command prompt.

  1. Create directories.

Create directories for your database and log files:

mkdir c:\data\db
mkdir c:\data\log
  1. Create a configuration file.

Create a configuration file. The file must set systemLog.path. Include additional configuration options as appropriate.

For example, create a file at C:\mongodb\mongod.cfg that specifies both systemLog.path and storage.dbPath:

systemLog:
    destination: file
    path: c:\data\log\mongod.log
storage:
    dbPath: c:\data\db
  1. Install the MongoDB service.

Important

Run all of the following commands in Command Prompt with “Administrative Privileges”.

Install the MongoDB service by starting mongod.exe with the --install option and the -config option to specify the previously created configuration file.

"C:\mongodb\bin\mongod.exe" --config "C:\mongodb\mongod.cfg" --install To use an alternate dbpath, specify the path in the configuration file (e.g. C:\mongodb\mongod.cfg) or on the command line with the --dbpath option.

If needed, you can install services for multiple instances of mongod.exe or mongos.exe. Install each service with a unique --serviceName and --serviceDisplayName. Use multiple instances only when sufficient system resources exist and your system design requires it.

  1. Start the MongoDB service.

    net start MongoDB

  2. Stop or remove the MongoDB service as needed.

To stop the MongoDB service use the following command:

net stop MongoDB

To remove the MongoDB service use the following command:

"C:\mongodb\bin\mongod.exe" --remove
like image 4
Robert Moon Avatar answered Nov 12 '22 22:11

Robert Moon


echo logpath=C:/myProgra/MongoDB/log/mongo.log > "C:\MyProgram\MongoDB\mongod.cfg" C:\myprogram\MongoDB\Server\3.0\bin\mongod.exe --config "C:\myProgram\MongoDB\mongod.cfg" --install

like image 1
richard Avatar answered Nov 12 '22 22:11

richard


I ran into the same problem. But I could resolve it by updating the paths as follows. I could see the problem is with Forward and backward slashes in file paths.

mongod.conf (instead of giving the relative path provide absolute path and also make sure you have "/" instead of "\")

dbpath= C:/mongolearning/db
logpath= C:/mongolearning/mongo-server.log
verbose=vvvvv

and then go to Command prompt:

C:\Program Files\MongoDB\Server\3.2\bin>mongod -f "C:\Program Files\MongoDB\Server\3.2\bin\mogod.conf" --install

and then

C:\Program Files\MongoDB\Server\3.2\bin>net start mongodb

Boom it started.

The MongoDB service is starting. The MongoDB service was started successfully.

like image 1
Naveen Avatar answered Nov 12 '22 23:11

Naveen