Senin, 18 Maret 2019

mongod: unrecognized service , mongod.service is present already





















5






























other services like apache2, etc are working fine.
But when I type sudo service mongod start I get this error:



mongod: unrecognized service



I have this file:



/lib/systemd/system/mongod.service 



It says this:



[Unit]

Description=High-performance, schema-free document-oriented database

After=network.target

Documentation=https://docs.mongodb.org/manual



[Service]

User=mongodb

Group=mongodb

ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

# file size

LimitFSIZE=infinity

# cpu time

LimitCPU=infinity

# virtual memory size

LimitAS=infinity

# open files

LimitNOFILE=64000

# processes/threads

LimitNPROC=64000

# total threads (user+kernel)

TasksMax=infinity

TasksAccounting=false



# Recommended limits for for mongod as specified in

# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings



[Install]

WantedBy=multi-user.target

















share|improve this question













































  • Did you resolve this? I have the same problem.



    – Brandon

    Mar 1 '17 at 2:40























  • @Brandon Its related to upstart and systemd.



    – user1735921

    May 16 '17 at 7:57






























5






























other services like apache2, etc are working fine.
But when I type sudo service mongod start I get this error:



mongod: unrecognized service



I have this file:



/lib/systemd/system/mongod.service 



It says this:



[Unit]

Description=High-performance, schema-free document-oriented database

After=network.target

Documentation=https://docs.mongodb.org/manual



[Service]

User=mongodb

Group=mongodb

ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

# file size

LimitFSIZE=infinity

# cpu time

LimitCPU=infinity

# virtual memory size

LimitAS=infinity

# open files

LimitNOFILE=64000

# processes/threads

LimitNPROC=64000

# total threads (user+kernel)

TasksMax=infinity

TasksAccounting=false



# Recommended limits for for mongod as specified in

# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings



[Install]

WantedBy=multi-user.target

















share|improve this question













































  • Did you resolve this? I have the same problem.



    – Brandon

    Mar 1 '17 at 2:40























  • @Brandon Its related to upstart and systemd.



    – user1735921

    May 16 '17 at 7:57


























5






















5














5


1










other services like apache2, etc are working fine.
But when I type sudo service mongod start I get this error:



mongod: unrecognized service



I have this file:



/lib/systemd/system/mongod.service 



It says this:



[Unit]

Description=High-performance, schema-free document-oriented database

After=network.target

Documentation=https://docs.mongodb.org/manual



[Service]

User=mongodb

Group=mongodb

ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

# file size

LimitFSIZE=infinity

# cpu time

LimitCPU=infinity

# virtual memory size

LimitAS=infinity

# open files

LimitNOFILE=64000

# processes/threads

LimitNPROC=64000

# total threads (user+kernel)

TasksMax=infinity

TasksAccounting=false



# Recommended limits for for mongod as specified in

# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings



[Install]

WantedBy=multi-user.target

















share|improve this question


























other services like apache2, etc are working fine.
But when I type sudo service mongod start I get this error:



mongod: unrecognized service



I have this file:



/lib/systemd/system/mongod.service 



It says this:



[Unit]

Description=High-performance, schema-free document-oriented database

After=network.target

Documentation=https://docs.mongodb.org/manual



[Service]

User=mongodb

Group=mongodb

ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf

# file size

LimitFSIZE=infinity

# cpu time

LimitCPU=infinity

# virtual memory size

LimitAS=infinity

# open files

LimitNOFILE=64000

# processes/threads

LimitNPROC=64000

# total threads (user+kernel)

TasksMax=infinity

TasksAccounting=false



# Recommended limits for for mongod as specified in

# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings



[Install]

WantedBy=multi-user.target








mongodb










share|improve this question























share|improve this question



















share|improve this question





share|improve this question














asked Dec 2 '16 at 8:41













user1735921user1735921



87210







87210
























  • Did you resolve this? I have the same problem.



    – Brandon

    Mar 1 '17 at 2:40























  • @Brandon Its related to upstart and systemd.



    – user1735921

    May 16 '17 at 7:57



































  • Did you resolve this? I have the same problem.



    – Brandon

    Mar 1 '17 at 2:40























  • @Brandon Its related to upstart and systemd.



    – user1735921

    May 16 '17 at 7:57




























Did you resolve this? I have the same problem.



– Brandon

Mar 1 '17 at 2:40









Did you resolve this? I have the same problem.



– Brandon

Mar 1 '17 at 2:40





















@Brandon Its related to upstart and systemd.



– user1735921

May 16 '17 at 7:57









@Brandon Its related to upstart and systemd.



– user1735921

May 16 '17 at 7:57

















3 Answers

3











active



oldest



votes





































4




























I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org



It looks like Mongodb created a systemd startup file which was already replaced by upstart.



As a workaround:




  1. Create a new file /etc/init/mongod.conf (requires sudo rights). You can use: sudo gedit /etc/init/mongod.conf



  2. Paste the following contents into the newly created upstart file:



    # Ubuntu upstart file at /etc/init/mongod.conf



    # Recommended ulimit values for mongod or mongos

    # See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

    #

    limit fsize unlimited unlimited

    limit cpu unlimited unlimited

    limit as unlimited unlimited

    limit nofile 64000 64000

    limit rss unlimited unlimited

    limit nproc 64000 64000



    kill timeout 300 # wait 300s between SIGTERM and SIGKILL.



    pre-start script

    DAEMONUSER=${DAEMONUSER:-mongodb}

    if [ ! -d /var/lib/mongodb ]; then

    mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb

    fi

    if [ ! -d /var/log/mongodb ]; then

    mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb

    fi

    touch /var/run/mongodb.pid

    chown $DAEMONUSER /var/run/mongodb.pid

    end script



    start on runlevel [2345]

    stop on runlevel [06]



    script

    ENABLE_MONGOD="yes"

    CONF=/etc/mongod.conf

    DAEMON=/usr/bin/mongod

    DAEMONUSER=${DAEMONUSER:-mongodb}

    DAEMONGROUP=${DAEMONGROUP:-mongodb}



    if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi



    # Handle NUMA access to CPUs (SERVER-3574)

    # This verifies the existence of numactl as well as testing that the command works

    NUMACTL_ARGS="--interleave=all"

    if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null

    then

    NUMACTL="$(which numactl) -- $NUMACTL_ARGS"

    DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}

    else

    NUMACTL=""

    DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}

    fi



    if [ "x$ENABLE_MONGOD" = "xyes" ]

    then

    exec start-stop-daemon --start

    --chuid $DAEMONUSER:$DAEMONGROUP

    --pidfile /var/run/mongodb.pid

    --make-pidfile

    --exec $NUMACTL $DAEMON $DAEMON_OPTS

    fi

    end script




  3. Now, you can use the following commands:



    sudo service mongod start



    sudo service mongod stop



    sudo service mongod status




reference:
https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart









share|improve this answer









































  • 1











    thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



    – user1735921

    Jun 15 '17 at 6:52










































1




























I kept getting the same error when trying to start the mongo service. mongod worked, but then I need to keep one terminal window open to use mongo in another. nothing else worked for me except this:



'mongod --fork --logpath /var/log/mongodb.log'



Above command starts the mongo daemon if you don't already have it started and then you can just type 'mongo' in command line and mongo works



(from here: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/)









share|improve this answer















































  • Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



    – user1735921

    Jan 4 at 7:23






































0




























I removed mongo lock file first



sudo rm /var/lib/mongodb/mongod.lock



then started the mongod using the following command



sudo mongod --fork -f /etc/mongod.conf









share|improve this answer













































    Your Answer















    StackExchange.ready(function() {

    var channelOptions = {

    tags: "".split(" "),

    id: "89"

    };

    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: true,

    noModals: true,

    showLowRepImageUploadWarning: true,

    reputationToPostImages: 10,

    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%2faskubuntu.com%2fquestions%2f856073%2fmongod-unrecognized-service-mongod-service-is-present-already%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

















    4




























    I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org



    It looks like Mongodb created a systemd startup file which was already replaced by upstart.



    As a workaround:




    1. Create a new file /etc/init/mongod.conf (requires sudo rights). You can use: sudo gedit /etc/init/mongod.conf



    2. Paste the following contents into the newly created upstart file:



      # Ubuntu upstart file at /etc/init/mongod.conf



      # Recommended ulimit values for mongod or mongos

      # See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

      #

      limit fsize unlimited unlimited

      limit cpu unlimited unlimited

      limit as unlimited unlimited

      limit nofile 64000 64000

      limit rss unlimited unlimited

      limit nproc 64000 64000



      kill timeout 300 # wait 300s between SIGTERM and SIGKILL.



      pre-start script

      DAEMONUSER=${DAEMONUSER:-mongodb}

      if [ ! -d /var/lib/mongodb ]; then

      mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb

      fi

      if [ ! -d /var/log/mongodb ]; then

      mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb

      fi

      touch /var/run/mongodb.pid

      chown $DAEMONUSER /var/run/mongodb.pid

      end script



      start on runlevel [2345]

      stop on runlevel [06]



      script

      ENABLE_MONGOD="yes"

      CONF=/etc/mongod.conf

      DAEMON=/usr/bin/mongod

      DAEMONUSER=${DAEMONUSER:-mongodb}

      DAEMONGROUP=${DAEMONGROUP:-mongodb}



      if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi



      # Handle NUMA access to CPUs (SERVER-3574)

      # This verifies the existence of numactl as well as testing that the command works

      NUMACTL_ARGS="--interleave=all"

      if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null

      then

      NUMACTL="$(which numactl) -- $NUMACTL_ARGS"

      DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}

      else

      NUMACTL=""

      DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}

      fi



      if [ "x$ENABLE_MONGOD" = "xyes" ]

      then

      exec start-stop-daemon --start

      --chuid $DAEMONUSER:$DAEMONGROUP

      --pidfile /var/run/mongodb.pid

      --make-pidfile

      --exec $NUMACTL $DAEMON $DAEMON_OPTS

      fi

      end script




    3. Now, you can use the following commands:



      sudo service mongod start



      sudo service mongod stop



      sudo service mongod status




    reference:
    https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart









    share|improve this answer









































    • 1











      thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



      – user1735921

      Jun 15 '17 at 6:52


































    4




























    I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org



    It looks like Mongodb created a systemd startup file which was already replaced by upstart.



    As a workaround:




    1. Create a new file /etc/init/mongod.conf (requires sudo rights). You can use: sudo gedit /etc/init/mongod.conf



    2. Paste the following contents into the newly created upstart file:



      # Ubuntu upstart file at /etc/init/mongod.conf



      # Recommended ulimit values for mongod or mongos

      # See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

      #

      limit fsize unlimited unlimited

      limit cpu unlimited unlimited

      limit as unlimited unlimited

      limit nofile 64000 64000

      limit rss unlimited unlimited

      limit nproc 64000 64000



      kill timeout 300 # wait 300s between SIGTERM and SIGKILL.



      pre-start script

      DAEMONUSER=${DAEMONUSER:-mongodb}

      if [ ! -d /var/lib/mongodb ]; then

      mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb

      fi

      if [ ! -d /var/log/mongodb ]; then

      mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb

      fi

      touch /var/run/mongodb.pid

      chown $DAEMONUSER /var/run/mongodb.pid

      end script



      start on runlevel [2345]

      stop on runlevel [06]



      script

      ENABLE_MONGOD="yes"

      CONF=/etc/mongod.conf

      DAEMON=/usr/bin/mongod

      DAEMONUSER=${DAEMONUSER:-mongodb}

      DAEMONGROUP=${DAEMONGROUP:-mongodb}



      if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi



      # Handle NUMA access to CPUs (SERVER-3574)

      # This verifies the existence of numactl as well as testing that the command works

      NUMACTL_ARGS="--interleave=all"

      if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null

      then

      NUMACTL="$(which numactl) -- $NUMACTL_ARGS"

      DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}

      else

      NUMACTL=""

      DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}

      fi



      if [ "x$ENABLE_MONGOD" = "xyes" ]

      then

      exec start-stop-daemon --start

      --chuid $DAEMONUSER:$DAEMONGROUP

      --pidfile /var/run/mongodb.pid

      --make-pidfile

      --exec $NUMACTL $DAEMON $DAEMON_OPTS

      fi

      end script




    3. Now, you can use the following commands:



      sudo service mongod start



      sudo service mongod stop



      sudo service mongod status




    reference:
    https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart









    share|improve this answer









































    • 1











      thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



      – user1735921

      Jun 15 '17 at 6:52






























    4






















    4














    4










    I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org



    It looks like Mongodb created a systemd startup file which was already replaced by upstart.



    As a workaround:




    1. Create a new file /etc/init/mongod.conf (requires sudo rights). You can use: sudo gedit /etc/init/mongod.conf



    2. Paste the following contents into the newly created upstart file:



      # Ubuntu upstart file at /etc/init/mongod.conf



      # Recommended ulimit values for mongod or mongos

      # See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

      #

      limit fsize unlimited unlimited

      limit cpu unlimited unlimited

      limit as unlimited unlimited

      limit nofile 64000 64000

      limit rss unlimited unlimited

      limit nproc 64000 64000



      kill timeout 300 # wait 300s between SIGTERM and SIGKILL.



      pre-start script

      DAEMONUSER=${DAEMONUSER:-mongodb}

      if [ ! -d /var/lib/mongodb ]; then

      mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb

      fi

      if [ ! -d /var/log/mongodb ]; then

      mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb

      fi

      touch /var/run/mongodb.pid

      chown $DAEMONUSER /var/run/mongodb.pid

      end script



      start on runlevel [2345]

      stop on runlevel [06]



      script

      ENABLE_MONGOD="yes"

      CONF=/etc/mongod.conf

      DAEMON=/usr/bin/mongod

      DAEMONUSER=${DAEMONUSER:-mongodb}

      DAEMONGROUP=${DAEMONGROUP:-mongodb}



      if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi



      # Handle NUMA access to CPUs (SERVER-3574)

      # This verifies the existence of numactl as well as testing that the command works

      NUMACTL_ARGS="--interleave=all"

      if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null

      then

      NUMACTL="$(which numactl) -- $NUMACTL_ARGS"

      DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}

      else

      NUMACTL=""

      DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}

      fi



      if [ "x$ENABLE_MONGOD" = "xyes" ]

      then

      exec start-stop-daemon --start

      --chuid $DAEMONUSER:$DAEMONGROUP

      --pidfile /var/run/mongodb.pid

      --make-pidfile

      --exec $NUMACTL $DAEMON $DAEMON_OPTS

      fi

      end script




    3. Now, you can use the following commands:



      sudo service mongod start



      sudo service mongod stop



      sudo service mongod status




    reference:
    https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart









    share|improve this answer




























    I had the same problem after pulling the ubuntu:17:04 docker image and installing mongodb-org



    It looks like Mongodb created a systemd startup file which was already replaced by upstart.



    As a workaround:




    1. Create a new file /etc/init/mongod.conf (requires sudo rights). You can use: sudo gedit /etc/init/mongod.conf



    2. Paste the following contents into the newly created upstart file:



      # Ubuntu upstart file at /etc/init/mongod.conf



      # Recommended ulimit values for mongod or mongos

      # See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings

      #

      limit fsize unlimited unlimited

      limit cpu unlimited unlimited

      limit as unlimited unlimited

      limit nofile 64000 64000

      limit rss unlimited unlimited

      limit nproc 64000 64000



      kill timeout 300 # wait 300s between SIGTERM and SIGKILL.



      pre-start script

      DAEMONUSER=${DAEMONUSER:-mongodb}

      if [ ! -d /var/lib/mongodb ]; then

      mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb

      fi

      if [ ! -d /var/log/mongodb ]; then

      mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb

      fi

      touch /var/run/mongodb.pid

      chown $DAEMONUSER /var/run/mongodb.pid

      end script



      start on runlevel [2345]

      stop on runlevel [06]



      script

      ENABLE_MONGOD="yes"

      CONF=/etc/mongod.conf

      DAEMON=/usr/bin/mongod

      DAEMONUSER=${DAEMONUSER:-mongodb}

      DAEMONGROUP=${DAEMONGROUP:-mongodb}



      if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi



      # Handle NUMA access to CPUs (SERVER-3574)

      # This verifies the existence of numactl as well as testing that the command works

      NUMACTL_ARGS="--interleave=all"

      if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null

      then

      NUMACTL="$(which numactl) -- $NUMACTL_ARGS"

      DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}

      else

      NUMACTL=""

      DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}

      fi



      if [ "x$ENABLE_MONGOD" = "xyes" ]

      then

      exec start-stop-daemon --start

      --chuid $DAEMONUSER:$DAEMONGROUP

      --pidfile /var/run/mongodb.pid

      --make-pidfile

      --exec $NUMACTL $DAEMON $DAEMON_OPTS

      fi

      end script




    3. Now, you can use the following commands:



      sudo service mongod start



      sudo service mongod stop



      sudo service mongod status




    reference:
    https://github.com/mongodb/mongo/blob/master/debian/mongod.upstart









    share|improve this answer

























    share|improve this answer



    share|improve this answer










    edited Nov 16 '17 at 14:58













    derHugo



    2,32321531







    2,32321531















    answered Jun 14 '17 at 18:40













    Hussein El MotayamHussein El Motayam



    42139







    42139














    • 1











      thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



      – user1735921

      Jun 15 '17 at 6:52





























    • 1











      thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



      – user1735921

      Jun 15 '17 at 6:52


















    1







    1









    thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



    – user1735921

    Jun 15 '17 at 6:52













    thankyou so much... upstart was the issue, i didn't have upstart, so I had do sudo mongod & everytime, but thanks the upstart script you mentioned, things will be lot more easier.



    – user1735921

    Jun 15 '17 at 6:52

























    1




























    I kept getting the same error when trying to start the mongo service. mongod worked, but then I need to keep one terminal window open to use mongo in another. nothing else worked for me except this:



    'mongod --fork --logpath /var/log/mongodb.log'



    Above command starts the mongo daemon if you don't already have it started and then you can just type 'mongo' in command line and mongo works



    (from here: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/)









    share|improve this answer















































    • Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



      – user1735921

      Jan 4 at 7:23






























    1




























    I kept getting the same error when trying to start the mongo service. mongod worked, but then I need to keep one terminal window open to use mongo in another. nothing else worked for me except this:



    'mongod --fork --logpath /var/log/mongodb.log'



    Above command starts the mongo daemon if you don't already have it started and then you can just type 'mongo' in command line and mongo works



    (from here: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/)









    share|improve this answer















































    • Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



      – user1735921

      Jan 4 at 7:23


























    1






















    1














    1










    I kept getting the same error when trying to start the mongo service. mongod worked, but then I need to keep one terminal window open to use mongo in another. nothing else worked for me except this:



    'mongod --fork --logpath /var/log/mongodb.log'



    Above command starts the mongo daemon if you don't already have it started and then you can just type 'mongo' in command line and mongo works



    (from here: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/)









    share|improve this answer
























    I kept getting the same error when trying to start the mongo service. mongod worked, but then I need to keep one terminal window open to use mongo in another. nothing else worked for me except this:



    'mongod --fork --logpath /var/log/mongodb.log'



    Above command starts the mongo daemon if you don't already have it started and then you can just type 'mongo' in command line and mongo works



    (from here: https://docs.mongodb.com/manual/tutorial/manage-mongodb-processes/)









    share|improve this answer





















    share|improve this answer



    share|improve this answer














    answered Jan 3 at 6:23













    user909945user909945



    111







    111
























    • Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



      – user1735921

      Jan 4 at 7:23



































    • Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



      – user1735921

      Jan 4 at 7:23




























    Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



    – user1735921

    Jan 4 at 7:23









    Thanks, I know about this already, because I was using it until I found the right upstart script, I wanted to have preconfigured commands, rather than typing such long commands every time with logpath and other configurations, so an upstart script is the best solution.



    – user1735921

    Jan 4 at 7:23



















    0




























    I removed mongo lock file first



    sudo rm /var/lib/mongodb/mongod.lock



    then started the mongod using the following command



    sudo mongod --fork -f /etc/mongod.conf









    share|improve this answer





















































      0




























      I removed mongo lock file first



      sudo rm /var/lib/mongodb/mongod.lock



      then started the mongod using the following command



      sudo mongod --fork -f /etc/mongod.conf









      share|improve this answer

















































        0






















        0














        0










        I removed mongo lock file first



        sudo rm /var/lib/mongodb/mongod.lock



        then started the mongod using the following command



        sudo mongod --fork -f /etc/mongod.conf









        share|improve this answer
























        I removed mongo lock file first



        sudo rm /var/lib/mongodb/mongod.lock



        then started the mongod using the following command



        sudo mongod --fork -f /etc/mongod.conf









        share|improve this answer





















        share|improve this answer



        share|improve this answer














        answered 20 mins ago













        RifaideenRifaideen



        17113







        17113


















































            draft saved


            draft discarded





















































































            Thanks for contributing an answer to Ask Ubuntu!


            • 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%2faskubuntu.com%2fquestions%2f856073%2fmongod-unrecognized-service-mongod-service-is-present-already%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









            mongod: unrecognized service , mongod.service is present already Rating: 4.5 Diposkan Oleh: Admin

            0 komentar:

            Posting Komentar

            Popular Posts