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

前端 未结 10 1511
庸人自扰
庸人自扰 2021-02-19 07:25

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 pro

相关标签:
10条回答
  • 2021-02-19 08:03

    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
    
    0 讨论(0)
  • 2021-02-19 08:13

    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

    0 讨论(0)
  • 2021-02-19 08:13

    there can't be quotation marks in your configure file . way like this is wrong:

    dbpath="D:/Program Files/MongoDB/Data/DB"
    logpath="D:/Program Files/MongoDB/Data/Log/mongo.log"
    

    downside is right:

    dbpath=D:/Program Files/MongoDB/Data/DB
    logpath=D:/Program Files/MongoDB/Data/Log/mongo.log
    
    0 讨论(0)
  • 2021-02-19 08:14

    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
    
    0 讨论(0)
  • 2021-02-19 08:14

    I faced the same problem while installing the MongoDB service by specifying the logpath and dbpath flags directly from the command line.

    mongod --install --logpath='<my log path>' --dbpath='<my db path>'
    

    It turned out that the logpath and dbpath values had to be wrapped inside double quotes (i.e. "") instead of single qoutes, or otherwise no quotes at all if the paths are without any spaces in the absolute directory path.

    So the following did the trick for me:

    mongod --install --logpath="<my log path>" --dbpath="<my db path>"
    

    Notice the paths wrapped within double qoutes.

    0 讨论(0)
  • 2021-02-19 08:15

    In the config file use absolute path instead of relative path for dbpath & logpath as like below and run the command to install the MongoDB service.

    dbpath = c:/Pluralsight/db (instead of /Pluralsight/db)  
    logpath = c:/Pluralsight/mongo-server.log (instead of Pluralsight/mongo-server.log)  
    verbose = vvvvv
    

    Command to install the MongoDB service is like:

    mongod -config "C:\Pluralsight\mongod.conf" --install
    
    0 讨论(0)
提交回复
热议问题