MongoDB — Failed global initialization: Failed to open “/var/log/mongodb/mongod-config.log”MongoDB —...

Is there any danger of my neighbor having my wife's signature?

Multiple null checks in Java 8

Why is it that Bernie Sanders always called a "socialist"?

UK visa start date and Flight Depature Time

How can changes in personality/values of a person who turned into a vampire be explained?

When distributing a Linux kernel driver as source code, what's the difference between Proprietary and GPL license?

Can you say "leftside right"?

Do the speed limit reductions due to pollution also apply to electric cars in France?

Why does this quiz question say that protons and electrons do not combine to form neutrons?

Why is Shelob considered evil?

Why is quixotic not Quixotic (a proper adjective)?

In the Lost in Space intro why was Dr. Smith actor listed as a special guest star?

Coworker asking me to not bring cakes due to self control issue. What should I do?

Boss asked me to sign a resignation paper without a date on it along with my new contract

Badly designed reimbursement form. What does that say about the company?

Cryptic cross... with words

Does the double-bladed scimitar's special attack let you use your ability modifier for the damage of the attack?

Buying a "Used" Router

How to transport 10,000 terrestrial trolls across ocean fast?

What is the reward?

How can I handle players killing my NPC outside of combat?

How can I persuade an unwilling soul to become willing?

What is formjacking?

Can I do anything else with aspersions other than cast them?



MongoDB — Failed global initialization: Failed to open “/var/log/mongodb/mongod-config.log”


MongoDB — Failed global initialization: Failed to open “var/log/mongodb/mongod.log”debian sudo service mongod status shows failed but mongo is workingWhen upgrading config servers to use WireTiger, the running config server with wiredtiger does not authenticate the existing pass and user?Mongo exception: connect failed on rebootMongoDB config replica failed connection after a few days runningMongodb Single replicaset cpu high even if chunks are equally partitioned in clusterHow to change default mongo port on a bitnami instanceInvalid sync source in mongodb config serverMongodb: change of hostname of an shard cluster, RS trys to connect to old IPMongodb upgrade from 3.0 to 3.2How to correct Failed global > initialization: FileNotOpen













3















I'm trying to setup the config servers for mongodb sharding. I created a specific config file that is set to log to /var/log/mongodb/mongod-config.log.



When I run mongod --config <path-to-config-file>, I get this error:



`F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
"/var/log/mongodb/mongod-config.log"`


When I run the same command but with sudo, it runs but there's no output.



But then when I try starting the mongo shell at the port (27019) specified by my config file, I get this:



MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27019/test
2018-05-01T03:13:13.399+0000 W NETWORK [thread1] Failed to connect to
127.0.0.1:27019, in(checking socket for error after poll), reason: Connection
refused
2018-05-01T03:13:13.400+0000 E QUERY [thread1] Error: couldn't connect to
server 127.0.0.1:27019, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed


I'm just following the MongoDB sharding documentation



I've seen some of the previous posts on here and one was the same problem. No solution there, but I want to try again and see if anybody has a solution to this.



Not sure if I missed something or what the issue is...










share|improve this question

























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

    – Md Haidar Ali Khan
    May 1 '18 at 3:55











  • I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

    – rapidDev
    May 1 '18 at 4:29











  • Did you checked your mongod.conf file. where it is directed to logpath.

    – Md Haidar Ali Khan
    May 1 '18 at 4:33











  • The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

    – rapidDev
    May 1 '18 at 4:43











  • ,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

    – Md Haidar Ali Khan
    May 1 '18 at 5:02
















3















I'm trying to setup the config servers for mongodb sharding. I created a specific config file that is set to log to /var/log/mongodb/mongod-config.log.



When I run mongod --config <path-to-config-file>, I get this error:



`F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
"/var/log/mongodb/mongod-config.log"`


When I run the same command but with sudo, it runs but there's no output.



But then when I try starting the mongo shell at the port (27019) specified by my config file, I get this:



MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27019/test
2018-05-01T03:13:13.399+0000 W NETWORK [thread1] Failed to connect to
127.0.0.1:27019, in(checking socket for error after poll), reason: Connection
refused
2018-05-01T03:13:13.400+0000 E QUERY [thread1] Error: couldn't connect to
server 127.0.0.1:27019, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed


I'm just following the MongoDB sharding documentation



I've seen some of the previous posts on here and one was the same problem. No solution there, but I want to try again and see if anybody has a solution to this.



Not sure if I missed something or what the issue is...










share|improve this question

























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

    – Md Haidar Ali Khan
    May 1 '18 at 3:55











  • I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

    – rapidDev
    May 1 '18 at 4:29











  • Did you checked your mongod.conf file. where it is directed to logpath.

    – Md Haidar Ali Khan
    May 1 '18 at 4:33











  • The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

    – rapidDev
    May 1 '18 at 4:43











  • ,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

    – Md Haidar Ali Khan
    May 1 '18 at 5:02














3












3








3








I'm trying to setup the config servers for mongodb sharding. I created a specific config file that is set to log to /var/log/mongodb/mongod-config.log.



When I run mongod --config <path-to-config-file>, I get this error:



`F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
"/var/log/mongodb/mongod-config.log"`


When I run the same command but with sudo, it runs but there's no output.



But then when I try starting the mongo shell at the port (27019) specified by my config file, I get this:



MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27019/test
2018-05-01T03:13:13.399+0000 W NETWORK [thread1] Failed to connect to
127.0.0.1:27019, in(checking socket for error after poll), reason: Connection
refused
2018-05-01T03:13:13.400+0000 E QUERY [thread1] Error: couldn't connect to
server 127.0.0.1:27019, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed


I'm just following the MongoDB sharding documentation



I've seen some of the previous posts on here and one was the same problem. No solution there, but I want to try again and see if anybody has a solution to this.



Not sure if I missed something or what the issue is...










share|improve this question
















I'm trying to setup the config servers for mongodb sharding. I created a specific config file that is set to log to /var/log/mongodb/mongod-config.log.



When I run mongod --config <path-to-config-file>, I get this error:



`F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
"/var/log/mongodb/mongod-config.log"`


When I run the same command but with sudo, it runs but there's no output.



But then when I try starting the mongo shell at the port (27019) specified by my config file, I get this:



MongoDB shell version v3.6.4
connecting to: mongodb://127.0.0.1:27019/test
2018-05-01T03:13:13.399+0000 W NETWORK [thread1] Failed to connect to
127.0.0.1:27019, in(checking socket for error after poll), reason: Connection
refused
2018-05-01T03:13:13.400+0000 E QUERY [thread1] Error: couldn't connect to
server 127.0.0.1:27019, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed


I'm just following the MongoDB sharding documentation



I've seen some of the previous posts on here and one was the same problem. No solution there, but I want to try again and see if anybody has a solution to this.



Not sure if I missed something or what the issue is...







mongodb configuration sharding






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 1 '18 at 3:34







rapidDev

















asked May 1 '18 at 3:19









rapidDevrapidDev

36112




36112













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

    – Md Haidar Ali Khan
    May 1 '18 at 3:55











  • I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

    – rapidDev
    May 1 '18 at 4:29











  • Did you checked your mongod.conf file. where it is directed to logpath.

    – Md Haidar Ali Khan
    May 1 '18 at 4:33











  • The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

    – rapidDev
    May 1 '18 at 4:43











  • ,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

    – Md Haidar Ali Khan
    May 1 '18 at 5:02



















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

    – Md Haidar Ali Khan
    May 1 '18 at 3:55











  • I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

    – rapidDev
    May 1 '18 at 4:29











  • Did you checked your mongod.conf file. where it is directed to logpath.

    – Md Haidar Ali Khan
    May 1 '18 at 4:33











  • The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

    – rapidDev
    May 1 '18 at 4:43











  • ,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

    – Md Haidar Ali Khan
    May 1 '18 at 5:02

















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

– Md Haidar Ali Khan
May 1 '18 at 3:55





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

– Md Haidar Ali Khan
May 1 '18 at 3:55













I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

– rapidDev
May 1 '18 at 4:29





I don't think that's the error... I ran the same mongod command, mongod --config <path-to-config-file> now with an absolute path to my config file, starting from the root directory "/". Still same error as above.

– rapidDev
May 1 '18 at 4:29













Did you checked your mongod.conf file. where it is directed to logpath.

– Md Haidar Ali Khan
May 1 '18 at 4:33





Did you checked your mongod.conf file. where it is directed to logpath.

– Md Haidar Ali Khan
May 1 '18 at 4:33













The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

– rapidDev
May 1 '18 at 4:43





The path to the log is set to the log file I created /var/log/mongodb/mongod-config.log. So, the issue doesn't seem to be there.

– rapidDev
May 1 '18 at 4:43













,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

– Md Haidar Ali Khan
May 1 '18 at 5:02





,Did you try to start mongod with port (27019) with --fork. use the --fork and --logpath options.

– Md Haidar Ali Khan
May 1 '18 at 5:02










3 Answers
3






active

oldest

votes


















1














So, I have figured out my own question.



Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.



Second, I changed the dbPath in my config file from /var/lib/mongodb to /data/db since that is the default path for mongodb to store data.



Make sure to run sudo service mongod restart after.



With that done, I was able to start mongod with my specific config file:



sudo mongod --config <path-to-config-file>


The key is to include sudo for me. That solved the issue of:



F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
"/var/log/mongodb/mongod-config.log"


After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:



mongo <ip_address_of_said_vm>:27019





share|improve this answer

































    0














    Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.



    logpath



    Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.



    /etc/mongod.conf



    $ cat /etc/mongod.conf
    # mongod.conf



    Where to store the data.



    Note: if you run mongodb as a non-root user (recommended) you may
    need to create and set permissions for this directory manually,
    e.g., if the parent directory isn't mutable by the mongodb user.



    dbpath=/var/lib/mongodb


    where to log



    logpath=/var/log/mongodb/mongod.log


    ...




    For Example



    Here i am mentioning one mongod.conf file with dbpath and logpath. And i shall show here how to start the mongod server as well as mongo shell.



    sharding:
    clusterRole: configsvr
    replication:
    replSetName: repltest
    security:
    keyFile: /var/mongodb/pki/replkeyfile
    net:
    bindIp: localhost,192.168.103.100
    port: 26001
    systemLog:
    destination: file
    path: /var/mongodb/db/csrs1/mongod.log
    logAppend: true
    processManagement:
    fork: true
    storage:
    dbPath: /var/mongodb/db/csrs1
    ~


    Then to start mongod with --fork , used the command such as



    /var/mongodb/db/csrs1$ mongod -f csrs1.conf



    about to fork child process, waiting until server is ready for
    connections. forked process: 2101 child process started successfully,
    parent exiting




    And to start the mongo shell



    mongo --port 26001


    Some of the MongoDB jira blog related to error here and here.



    For further your ref here and here






    share|improve this answer

































      0














      I also faced the same problem while trying to start mongodb service in my Debian9 64bit server. I could see the below information while checking status.



      :~# systemctl status mongod.service
      ● mongod.service - High-performance, schema-free document-oriented database
      Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
      Active: failed (Result: exit-code) since Fri 2019-02-22 14:52:17 CET; 11s ago
      Docs: https://docs.mongodb.org/manual
      Process: 20914 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
      Main PID: 20914 (code=exited, status=1/FAILURE)

      Feb 22 14:52:17 server-test systemd[1]: Started High-performance, schema-free document-oriented database.
      Feb 22 14:52:17 server-test mongod[20914]: 2019-02-22T14:52:17.650+0100
      F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
      Feb 22 14:52:17 server-test systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
      Feb 22 14:52:17 server-test systemd[1]: mongod.service: Unit entered failed state.
      Feb 22 14:52:17 server-test systemd[1]: mongod.service: Failed with result 'exit-code'.


      I have also got detailed information of each start command result in "/var/log/daemon.log". I could see the information "Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log" which was one of the clue for the issue. While checking i could see mongod.log file was under root ownership and service was starting under the user "mongodb". So applied the below fix.



      fix1: -  chown mongodb:mongodb /var/log/mongodb/mongod.log


      While trying to start again, i could see service showing new error this time in "daemon.log"



      mongod.service: Main process exited, code=exited, status=100/n/a
      mongod.service: Unit entered failed state.


      This error caused as mongodb file storage location has issues and unable to access its files.



      fix2.  chown -R mongodb:mongodb /var/lib/mongodb/*


      See the screen shot attached. Now I am able to start the service.



      enter image description here






      share|improve this answer























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "182"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f205412%2fmongodb-failed-global-initialization-failed-to-open-var-log-mongodb-mongo%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        3 Answers
        3






        active

        oldest

        votes








        3 Answers
        3






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        1














        So, I have figured out my own question.



        Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.



        Second, I changed the dbPath in my config file from /var/lib/mongodb to /data/db since that is the default path for mongodb to store data.



        Make sure to run sudo service mongod restart after.



        With that done, I was able to start mongod with my specific config file:



        sudo mongod --config <path-to-config-file>


        The key is to include sudo for me. That solved the issue of:



        F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
        "/var/log/mongodb/mongod-config.log"


        After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:



        mongo <ip_address_of_said_vm>:27019





        share|improve this answer






























          1














          So, I have figured out my own question.



          Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.



          Second, I changed the dbPath in my config file from /var/lib/mongodb to /data/db since that is the default path for mongodb to store data.



          Make sure to run sudo service mongod restart after.



          With that done, I was able to start mongod with my specific config file:



          sudo mongod --config <path-to-config-file>


          The key is to include sudo for me. That solved the issue of:



          F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
          "/var/log/mongodb/mongod-config.log"


          After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:



          mongo <ip_address_of_said_vm>:27019





          share|improve this answer




























            1












            1








            1







            So, I have figured out my own question.



            Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.



            Second, I changed the dbPath in my config file from /var/lib/mongodb to /data/db since that is the default path for mongodb to store data.



            Make sure to run sudo service mongod restart after.



            With that done, I was able to start mongod with my specific config file:



            sudo mongod --config <path-to-config-file>


            The key is to include sudo for me. That solved the issue of:



            F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
            "/var/log/mongodb/mongod-config.log"


            After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:



            mongo <ip_address_of_said_vm>:27019





            share|improve this answer















            So, I have figured out my own question.



            Firstly, the issue was that since I was using a different port 27019 for the config servers, I needed to open that port from the firewall.



            Second, I changed the dbPath in my config file from /var/lib/mongodb to /data/db since that is the default path for mongodb to store data.



            Make sure to run sudo service mongod restart after.



            With that done, I was able to start mongod with my specific config file:



            sudo mongod --config <path-to-config-file>


            The key is to include sudo for me. That solved the issue of:



            F CONTROL  [main] Failed global initialization: FileNotOpen: Failed to open 
            "/var/log/mongodb/mongod-config.log"


            After running the command, I see that mongod has started on my virtual machine (vm) and now I am able to connect to the mongo shell of said vm from another machine with:



            mongo <ip_address_of_said_vm>:27019






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited May 3 '18 at 17:24

























            answered May 1 '18 at 5:12









            rapidDevrapidDev

            36112




            36112

























                0














                Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.



                logpath



                Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.



                /etc/mongod.conf



                $ cat /etc/mongod.conf
                # mongod.conf



                Where to store the data.



                Note: if you run mongodb as a non-root user (recommended) you may
                need to create and set permissions for this directory manually,
                e.g., if the parent directory isn't mutable by the mongodb user.



                dbpath=/var/lib/mongodb


                where to log



                logpath=/var/log/mongodb/mongod.log


                ...




                For Example



                Here i am mentioning one mongod.conf file with dbpath and logpath. And i shall show here how to start the mongod server as well as mongo shell.



                sharding:
                clusterRole: configsvr
                replication:
                replSetName: repltest
                security:
                keyFile: /var/mongodb/pki/replkeyfile
                net:
                bindIp: localhost,192.168.103.100
                port: 26001
                systemLog:
                destination: file
                path: /var/mongodb/db/csrs1/mongod.log
                logAppend: true
                processManagement:
                fork: true
                storage:
                dbPath: /var/mongodb/db/csrs1
                ~


                Then to start mongod with --fork , used the command such as



                /var/mongodb/db/csrs1$ mongod -f csrs1.conf



                about to fork child process, waiting until server is ready for
                connections. forked process: 2101 child process started successfully,
                parent exiting




                And to start the mongo shell



                mongo --port 26001


                Some of the MongoDB jira blog related to error here and here.



                For further your ref here and here






                share|improve this answer






























                  0














                  Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.



                  logpath



                  Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.



                  /etc/mongod.conf



                  $ cat /etc/mongod.conf
                  # mongod.conf



                  Where to store the data.



                  Note: if you run mongodb as a non-root user (recommended) you may
                  need to create and set permissions for this directory manually,
                  e.g., if the parent directory isn't mutable by the mongodb user.



                  dbpath=/var/lib/mongodb


                  where to log



                  logpath=/var/log/mongodb/mongod.log


                  ...




                  For Example



                  Here i am mentioning one mongod.conf file with dbpath and logpath. And i shall show here how to start the mongod server as well as mongo shell.



                  sharding:
                  clusterRole: configsvr
                  replication:
                  replSetName: repltest
                  security:
                  keyFile: /var/mongodb/pki/replkeyfile
                  net:
                  bindIp: localhost,192.168.103.100
                  port: 26001
                  systemLog:
                  destination: file
                  path: /var/mongodb/db/csrs1/mongod.log
                  logAppend: true
                  processManagement:
                  fork: true
                  storage:
                  dbPath: /var/mongodb/db/csrs1
                  ~


                  Then to start mongod with --fork , used the command such as



                  /var/mongodb/db/csrs1$ mongod -f csrs1.conf



                  about to fork child process, waiting until server is ready for
                  connections. forked process: 2101 child process started successfully,
                  parent exiting




                  And to start the mongo shell



                  mongo --port 26001


                  Some of the MongoDB jira blog related to error here and here.



                  For further your ref here and here






                  share|improve this answer




























                    0












                    0








                    0







                    Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.



                    logpath



                    Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.



                    /etc/mongod.conf



                    $ cat /etc/mongod.conf
                    # mongod.conf



                    Where to store the data.



                    Note: if you run mongodb as a non-root user (recommended) you may
                    need to create and set permissions for this directory manually,
                    e.g., if the parent directory isn't mutable by the mongodb user.



                    dbpath=/var/lib/mongodb


                    where to log



                    logpath=/var/log/mongodb/mongod.log


                    ...




                    For Example



                    Here i am mentioning one mongod.conf file with dbpath and logpath. And i shall show here how to start the mongod server as well as mongo shell.



                    sharding:
                    clusterRole: configsvr
                    replication:
                    replSetName: repltest
                    security:
                    keyFile: /var/mongodb/pki/replkeyfile
                    net:
                    bindIp: localhost,192.168.103.100
                    port: 26001
                    systemLog:
                    destination: file
                    path: /var/mongodb/db/csrs1/mongod.log
                    logAppend: true
                    processManagement:
                    fork: true
                    storage:
                    dbPath: /var/mongodb/db/csrs1
                    ~


                    Then to start mongod with --fork , used the command such as



                    /var/mongodb/db/csrs1$ mongod -f csrs1.conf



                    about to fork child process, waiting until server is ready for
                    connections. forked process: 2101 child process started successfully,
                    parent exiting




                    And to start the mongo shell



                    mongo --port 26001


                    Some of the MongoDB jira blog related to error here and here.



                    For further your ref here and here






                    share|improve this answer















                    Default, MongoDB creates the log file at this path /var/log/mongodb/mongodb.log, if the log file is not found, please check with the MongoDB config file.



                    logpath



                    Check the MongoDB config file at /etc/mongod.conf or /yourMongoDBpath/mongod.conf, the logpath defined where to log.



                    /etc/mongod.conf



                    $ cat /etc/mongod.conf
                    # mongod.conf



                    Where to store the data.



                    Note: if you run mongodb as a non-root user (recommended) you may
                    need to create and set permissions for this directory manually,
                    e.g., if the parent directory isn't mutable by the mongodb user.



                    dbpath=/var/lib/mongodb


                    where to log



                    logpath=/var/log/mongodb/mongod.log


                    ...




                    For Example



                    Here i am mentioning one mongod.conf file with dbpath and logpath. And i shall show here how to start the mongod server as well as mongo shell.



                    sharding:
                    clusterRole: configsvr
                    replication:
                    replSetName: repltest
                    security:
                    keyFile: /var/mongodb/pki/replkeyfile
                    net:
                    bindIp: localhost,192.168.103.100
                    port: 26001
                    systemLog:
                    destination: file
                    path: /var/mongodb/db/csrs1/mongod.log
                    logAppend: true
                    processManagement:
                    fork: true
                    storage:
                    dbPath: /var/mongodb/db/csrs1
                    ~


                    Then to start mongod with --fork , used the command such as



                    /var/mongodb/db/csrs1$ mongod -f csrs1.conf



                    about to fork child process, waiting until server is ready for
                    connections. forked process: 2101 child process started successfully,
                    parent exiting




                    And to start the mongo shell



                    mongo --port 26001


                    Some of the MongoDB jira blog related to error here and here.



                    For further your ref here and here







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited May 1 '18 at 5:25

























                    answered May 1 '18 at 4:32









                    Md Haidar Ali KhanMd Haidar Ali Khan

                    3,69462342




                    3,69462342























                        0














                        I also faced the same problem while trying to start mongodb service in my Debian9 64bit server. I could see the below information while checking status.



                        :~# systemctl status mongod.service
                        ● mongod.service - High-performance, schema-free document-oriented database
                        Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
                        Active: failed (Result: exit-code) since Fri 2019-02-22 14:52:17 CET; 11s ago
                        Docs: https://docs.mongodb.org/manual
                        Process: 20914 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
                        Main PID: 20914 (code=exited, status=1/FAILURE)

                        Feb 22 14:52:17 server-test systemd[1]: Started High-performance, schema-free document-oriented database.
                        Feb 22 14:52:17 server-test mongod[20914]: 2019-02-22T14:52:17.650+0100
                        F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
                        Feb 22 14:52:17 server-test systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
                        Feb 22 14:52:17 server-test systemd[1]: mongod.service: Unit entered failed state.
                        Feb 22 14:52:17 server-test systemd[1]: mongod.service: Failed with result 'exit-code'.


                        I have also got detailed information of each start command result in "/var/log/daemon.log". I could see the information "Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log" which was one of the clue for the issue. While checking i could see mongod.log file was under root ownership and service was starting under the user "mongodb". So applied the below fix.



                        fix1: -  chown mongodb:mongodb /var/log/mongodb/mongod.log


                        While trying to start again, i could see service showing new error this time in "daemon.log"



                        mongod.service: Main process exited, code=exited, status=100/n/a
                        mongod.service: Unit entered failed state.


                        This error caused as mongodb file storage location has issues and unable to access its files.



                        fix2.  chown -R mongodb:mongodb /var/lib/mongodb/*


                        See the screen shot attached. Now I am able to start the service.



                        enter image description here






                        share|improve this answer




























                          0














                          I also faced the same problem while trying to start mongodb service in my Debian9 64bit server. I could see the below information while checking status.



                          :~# systemctl status mongod.service
                          ● mongod.service - High-performance, schema-free document-oriented database
                          Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
                          Active: failed (Result: exit-code) since Fri 2019-02-22 14:52:17 CET; 11s ago
                          Docs: https://docs.mongodb.org/manual
                          Process: 20914 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
                          Main PID: 20914 (code=exited, status=1/FAILURE)

                          Feb 22 14:52:17 server-test systemd[1]: Started High-performance, schema-free document-oriented database.
                          Feb 22 14:52:17 server-test mongod[20914]: 2019-02-22T14:52:17.650+0100
                          F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
                          Feb 22 14:52:17 server-test systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
                          Feb 22 14:52:17 server-test systemd[1]: mongod.service: Unit entered failed state.
                          Feb 22 14:52:17 server-test systemd[1]: mongod.service: Failed with result 'exit-code'.


                          I have also got detailed information of each start command result in "/var/log/daemon.log". I could see the information "Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log" which was one of the clue for the issue. While checking i could see mongod.log file was under root ownership and service was starting under the user "mongodb". So applied the below fix.



                          fix1: -  chown mongodb:mongodb /var/log/mongodb/mongod.log


                          While trying to start again, i could see service showing new error this time in "daemon.log"



                          mongod.service: Main process exited, code=exited, status=100/n/a
                          mongod.service: Unit entered failed state.


                          This error caused as mongodb file storage location has issues and unable to access its files.



                          fix2.  chown -R mongodb:mongodb /var/lib/mongodb/*


                          See the screen shot attached. Now I am able to start the service.



                          enter image description here






                          share|improve this answer


























                            0












                            0








                            0







                            I also faced the same problem while trying to start mongodb service in my Debian9 64bit server. I could see the below information while checking status.



                            :~# systemctl status mongod.service
                            ● mongod.service - High-performance, schema-free document-oriented database
                            Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
                            Active: failed (Result: exit-code) since Fri 2019-02-22 14:52:17 CET; 11s ago
                            Docs: https://docs.mongodb.org/manual
                            Process: 20914 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
                            Main PID: 20914 (code=exited, status=1/FAILURE)

                            Feb 22 14:52:17 server-test systemd[1]: Started High-performance, schema-free document-oriented database.
                            Feb 22 14:52:17 server-test mongod[20914]: 2019-02-22T14:52:17.650+0100
                            F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Unit entered failed state.
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Failed with result 'exit-code'.


                            I have also got detailed information of each start command result in "/var/log/daemon.log". I could see the information "Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log" which was one of the clue for the issue. While checking i could see mongod.log file was under root ownership and service was starting under the user "mongodb". So applied the below fix.



                            fix1: -  chown mongodb:mongodb /var/log/mongodb/mongod.log


                            While trying to start again, i could see service showing new error this time in "daemon.log"



                            mongod.service: Main process exited, code=exited, status=100/n/a
                            mongod.service: Unit entered failed state.


                            This error caused as mongodb file storage location has issues and unable to access its files.



                            fix2.  chown -R mongodb:mongodb /var/lib/mongodb/*


                            See the screen shot attached. Now I am able to start the service.



                            enter image description here






                            share|improve this answer













                            I also faced the same problem while trying to start mongodb service in my Debian9 64bit server. I could see the below information while checking status.



                            :~# systemctl status mongod.service
                            ● mongod.service - High-performance, schema-free document-oriented database
                            Loaded: loaded (/etc/systemd/system/mongod.service; enabled; vendor preset: enabled)
                            Active: failed (Result: exit-code) since Fri 2019-02-22 14:52:17 CET; 11s ago
                            Docs: https://docs.mongodb.org/manual
                            Process: 20914 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=1/FAILURE)
                            Main PID: 20914 (code=exited, status=1/FAILURE)

                            Feb 22 14:52:17 server-test systemd[1]: Started High-performance, schema-free document-oriented database.
                            Feb 22 14:52:17 server-test mongod[20914]: 2019-02-22T14:52:17.650+0100
                            F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log"
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Main process exited, code=exited, status=1/FAILURE
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Unit entered failed state.
                            Feb 22 14:52:17 server-test systemd[1]: mongod.service: Failed with result 'exit-code'.


                            I have also got detailed information of each start command result in "/var/log/daemon.log". I could see the information "Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongod.log" which was one of the clue for the issue. While checking i could see mongod.log file was under root ownership and service was starting under the user "mongodb". So applied the below fix.



                            fix1: -  chown mongodb:mongodb /var/log/mongodb/mongod.log


                            While trying to start again, i could see service showing new error this time in "daemon.log"



                            mongod.service: Main process exited, code=exited, status=100/n/a
                            mongod.service: Unit entered failed state.


                            This error caused as mongodb file storage location has issues and unable to access its files.



                            fix2.  chown -R mongodb:mongodb /var/lib/mongodb/*


                            See the screen shot attached. Now I am able to start the service.



                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered 13 mins ago









                            nisamudeen97nisamudeen97

                            614




                            614






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Database Administrators Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f205412%2fmongodb-failed-global-initialization-failed-to-open-var-log-mongodb-mongo%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

                                Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

                                How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...