Mongodb exception: connect failed












0















Here's the environment:




  1. Linux(x64): 16.04

  2. MongoDB: 3.2.15


Error:



root@system-test:~# mongo
MongoDB shell version: 3.2.15
connecting to: test
2017-07-25T07:31:28.528+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-07-25T07:31:28.530+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed
root@system-test:~#


When I tried to see the status I get this:



root@system-test:~# sudo service mongodb status
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-07-25 07:45:32 UTC; 1min 8s ago
Process: 1721 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 1721 (code=exited, status=14)

Jul 25 07:45:32 system-test systemd[1]: Started High-performance, schema-free document-oriented database.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Unit entered failed state.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Failed with result 'exit-code'.


How it happened:



I tried to stop MongoDB and did the following



sudo service mongo stop [This didn't work].



Then i tried kill - 2 <PID> [Seem didn't worked too]



But after this command #mongo stopped working and getting the above error.



Please help guys










share|improve this question























  • Please attach last 20 lines of MongoDB log file

    – Learning DBA
    Jul 26 '17 at 12:23
















0















Here's the environment:




  1. Linux(x64): 16.04

  2. MongoDB: 3.2.15


Error:



root@system-test:~# mongo
MongoDB shell version: 3.2.15
connecting to: test
2017-07-25T07:31:28.528+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-07-25T07:31:28.530+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed
root@system-test:~#


When I tried to see the status I get this:



root@system-test:~# sudo service mongodb status
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-07-25 07:45:32 UTC; 1min 8s ago
Process: 1721 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 1721 (code=exited, status=14)

Jul 25 07:45:32 system-test systemd[1]: Started High-performance, schema-free document-oriented database.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Unit entered failed state.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Failed with result 'exit-code'.


How it happened:



I tried to stop MongoDB and did the following



sudo service mongo stop [This didn't work].



Then i tried kill - 2 <PID> [Seem didn't worked too]



But after this command #mongo stopped working and getting the above error.



Please help guys










share|improve this question























  • Please attach last 20 lines of MongoDB log file

    – Learning DBA
    Jul 26 '17 at 12:23














0












0








0


1






Here's the environment:




  1. Linux(x64): 16.04

  2. MongoDB: 3.2.15


Error:



root@system-test:~# mongo
MongoDB shell version: 3.2.15
connecting to: test
2017-07-25T07:31:28.528+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-07-25T07:31:28.530+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed
root@system-test:~#


When I tried to see the status I get this:



root@system-test:~# sudo service mongodb status
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-07-25 07:45:32 UTC; 1min 8s ago
Process: 1721 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 1721 (code=exited, status=14)

Jul 25 07:45:32 system-test systemd[1]: Started High-performance, schema-free document-oriented database.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Unit entered failed state.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Failed with result 'exit-code'.


How it happened:



I tried to stop MongoDB and did the following



sudo service mongo stop [This didn't work].



Then i tried kill - 2 <PID> [Seem didn't worked too]



But after this command #mongo stopped working and getting the above error.



Please help guys










share|improve this question














Here's the environment:




  1. Linux(x64): 16.04

  2. MongoDB: 3.2.15


Error:



root@system-test:~# mongo
MongoDB shell version: 3.2.15
connecting to: test
2017-07-25T07:31:28.528+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: errno:111 Connection refused
2017-07-25T07:31:28.530+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:229:14
@(connect):1:6

exception: connect failed
root@system-test:~#


When I tried to see the status I get this:



root@system-test:~# sudo service mongodb status
● mongodb.service - High-performance, schema-free document-oriented database
Loaded: loaded (/etc/systemd/system/mongodb.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2017-07-25 07:45:32 UTC; 1min 8s ago
Process: 1721 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
Main PID: 1721 (code=exited, status=14)

Jul 25 07:45:32 system-test systemd[1]: Started High-performance, schema-free document-oriented database.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Main process exited, code=exited, status=14/n/a
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Unit entered failed state.
Jul 25 07:45:32 system-test systemd[1]: mongodb.service: Failed with result 'exit-code'.


How it happened:



I tried to stop MongoDB and did the following



sudo service mongo stop [This didn't work].



Then i tried kill - 2 <PID> [Seem didn't worked too]



But after this command #mongo stopped working and getting the above error.



Please help guys







mongodb mongodb-3.2 mongo-repair






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jul 25 '17 at 7:59









Siddhartha ChowdhurySiddhartha Chowdhury

103114




103114













  • Please attach last 20 lines of MongoDB log file

    – Learning DBA
    Jul 26 '17 at 12:23



















  • Please attach last 20 lines of MongoDB log file

    – Learning DBA
    Jul 26 '17 at 12:23

















Please attach last 20 lines of MongoDB log file

– Learning DBA
Jul 26 '17 at 12:23





Please attach last 20 lines of MongoDB log file

– Learning DBA
Jul 26 '17 at 12:23










3 Answers
3






active

oldest

votes


















1















sudo service mongo stop [This didn't work]




As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.



And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.



As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.



So, in place sudo service mongo stop it should be the below mention command




sudo service mongod stop




As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:



Start MongoDB



sudo service mongod start


Stop MongoDB



sudo service mongod stop


Restart MongoDB



sudo service mongod restart


Verify that MongoDB has started successfully



sudo chkconfig mongod on


Begin using MongoDB



Start a mongo shell on the same host machine as the mongod



mongo --host 127.0.0.1:27017





share|improve this answer































    0














    As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot.



    So, restart your mongod sudo service mongodb restart, try now to connect it mongo.



    If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then in other terminal say sudo service mongodb stop, some times shutdown process can take quite long time.. As startup process too.






    share|improve this answer































      0














      I also ran into same issue. But was able to resolve by completely removing mongo first



      sudo apt-get purge mongodb-org*


      Then performing following



      sudo apt update
      sudo apt install -y mongodb
      sudo systemctl status mongodb


      You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04






      share|improve this answer








      New contributor




      Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        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%2f181693%2fmongodb-exception-connect-failed%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















        sudo service mongo stop [This didn't work]




        As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.



        And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.



        As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.



        So, in place sudo service mongo stop it should be the below mention command




        sudo service mongod stop




        As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:



        Start MongoDB



        sudo service mongod start


        Stop MongoDB



        sudo service mongod stop


        Restart MongoDB



        sudo service mongod restart


        Verify that MongoDB has started successfully



        sudo chkconfig mongod on


        Begin using MongoDB



        Start a mongo shell on the same host machine as the mongod



        mongo --host 127.0.0.1:27017





        share|improve this answer




























          1















          sudo service mongo stop [This didn't work]




          As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.



          And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.



          As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.



          So, in place sudo service mongo stop it should be the below mention command




          sudo service mongod stop




          As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:



          Start MongoDB



          sudo service mongod start


          Stop MongoDB



          sudo service mongod stop


          Restart MongoDB



          sudo service mongod restart


          Verify that MongoDB has started successfully



          sudo chkconfig mongod on


          Begin using MongoDB



          Start a mongo shell on the same host machine as the mongod



          mongo --host 127.0.0.1:27017





          share|improve this answer


























            1












            1








            1








            sudo service mongo stop [This didn't work]




            As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.



            And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.



            As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.



            So, in place sudo service mongo stop it should be the below mention command




            sudo service mongod stop




            As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:



            Start MongoDB



            sudo service mongod start


            Stop MongoDB



            sudo service mongod stop


            Restart MongoDB



            sudo service mongod restart


            Verify that MongoDB has started successfully



            sudo chkconfig mongod on


            Begin using MongoDB



            Start a mongo shell on the same host machine as the mongod



            mongo --host 127.0.0.1:27017





            share|improve this answer














            sudo service mongo stop [This didn't work]




            As MongoDB BOL mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB.



            And mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.



            As simple language we can say that mongo is shell interface for MongoDB. And mongod is server , which handles data requests, manages data access, and performs background management operations.



            So, in place sudo service mongo stop it should be the below mention command




            sudo service mongod stop




            As MongoDB documented Here Some of basic procedure to check MongoDB services in RHEL is as mention below:



            Start MongoDB



            sudo service mongod start


            Stop MongoDB



            sudo service mongod stop


            Restart MongoDB



            sudo service mongod restart


            Verify that MongoDB has started successfully



            sudo chkconfig mongod on


            Begin using MongoDB



            Start a mongo shell on the same host machine as the mongod



            mongo --host 127.0.0.1:27017






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 20 '17 at 8:10









            Md Haidar Ali KhanMd Haidar Ali Khan

            3,62662342




            3,62662342

























                0














                As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot.



                So, restart your mongod sudo service mongodb restart, try now to connect it mongo.



                If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then in other terminal say sudo service mongodb stop, some times shutdown process can take quite long time.. As startup process too.






                share|improve this answer




























                  0














                  As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot.



                  So, restart your mongod sudo service mongodb restart, try now to connect it mongo.



                  If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then in other terminal say sudo service mongodb stop, some times shutdown process can take quite long time.. As startup process too.






                  share|improve this answer


























                    0












                    0








                    0







                    As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot.



                    So, restart your mongod sudo service mongodb restart, try now to connect it mongo.



                    If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then in other terminal say sudo service mongodb stop, some times shutdown process can take quite long time.. As startup process too.






                    share|improve this answer













                    As your service mongodb status tells, your mongod process don't exists. So, if you try to connect (with mongo -program) to your mongod, you cannot.



                    So, restart your mongod sudo service mongodb restart, try now to connect it mongo.



                    If you want to see what happens when you shutdown, start following mongodb.log tail -f /var/log/mongodb/mongodb.log and then in other terminal say sudo service mongodb stop, some times shutdown process can take quite long time.. As startup process too.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jul 25 '17 at 9:23









                    JJussiJJussi

                    3,0691314




                    3,0691314























                        0














                        I also ran into same issue. But was able to resolve by completely removing mongo first



                        sudo apt-get purge mongodb-org*


                        Then performing following



                        sudo apt update
                        sudo apt install -y mongodb
                        sudo systemctl status mongodb


                        You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04






                        share|improve this answer








                        New contributor




                        Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          0














                          I also ran into same issue. But was able to resolve by completely removing mongo first



                          sudo apt-get purge mongodb-org*


                          Then performing following



                          sudo apt update
                          sudo apt install -y mongodb
                          sudo systemctl status mongodb


                          You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04






                          share|improve this answer








                          New contributor




                          Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.























                            0












                            0








                            0







                            I also ran into same issue. But was able to resolve by completely removing mongo first



                            sudo apt-get purge mongodb-org*


                            Then performing following



                            sudo apt update
                            sudo apt install -y mongodb
                            sudo systemctl status mongodb


                            You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04






                            share|improve this answer








                            New contributor




                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            I also ran into same issue. But was able to resolve by completely removing mongo first



                            sudo apt-get purge mongodb-org*


                            Then performing following



                            sudo apt update
                            sudo apt install -y mongodb
                            sudo systemctl status mongodb


                            You can refer to following link for the same: https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04







                            share|improve this answer








                            New contributor




                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            share|improve this answer



                            share|improve this answer






                            New contributor




                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered 25 mins ago









                            Hari Prasad SharmaHari Prasad Sharma

                            101




                            101




                            New contributor




                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            Hari Prasad Sharma is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






























                                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%2f181693%2fmongodb-exception-connect-failed%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

                                Liste der Baudenkmale in Friedland (Mecklenburg)

                                Single-Malt-Whisky

                                Czorneboh