Error while installing and running mongod

workspace
mongodb

#1

Hello.

I am tring to install modgodb but when I am starting mongodb I get this error:

2017-10-28T17:59:00.859+0000 ** WARNING: --rest is specified without --httpinterface,
2017-10-28T17:59:00.859+0000 **          enabling http interface
warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
2017-10-28T17:59:00.862+0000 [initandlisten] MongoDB starting : pid=5102 port=27017 dbpath=data 64-bit host=austrisu-web-dev-bootcamp-5488380
2017-10-28T17:59:00.862+0000 [initandlisten] db version v2.6.12
2017-10-28T17:59:00.862+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2017-10-28T17:59:00.862+0000 [initandlisten] build info: Linux build5.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2017-10-28T17:59:00.862+0000 [initandlisten] allocator: tcmalloc
2017-10-28T17:59:00.863+0000 [initandlisten] options: { net: { bindIp: "0.0.0.0", http: { RESTInterfaceEnabled: true, enabled: true } }, storage: { dbPath: "data", journal: { enabled: false } } }
2017-10-28T17:59:00.863+0000 [initandlisten] exception in initAndListen: 10296 
*********************************************************************
 ERROR: dbpath (data) does not exist.
 Create this directory or give existing directory in --dbpath.
 See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2017-10-28T17:59:00.863+0000 [initandlisten] dbexit: 
2017-10-28T17:59:00.863+0000 [initandlisten] shutdown: going to close listening sockets...
2017-10-28T17:59:00.863+0000 [initandlisten] shutdown: going to flush diaglog...
2017-10-28T17:59:00.863+0000 [initandlisten] shutdown: going to close sockets...
2017-10-28T17:59:00.863+0000 [initandlisten] shutdown: waiting for fs preallocator...
2017-10-28T17:59:00.863+0000 [initandlisten] shutdown: closing all files...
2017-10-28T17:59:00.863+0000 [initandlisten] closeAllFiles() finished
2017-10-28T17:59:00.863+0000 [initandlisten] dbexit: really exiting now

The proces I have installed mongodb is like this:

  • cd out of the workspace and created data directory, so when ls I see data/ lib/ workspace/

  • then I ran sudo apt-get install -y mongodb-org

  • cd in to/data

  • run comands

    $ echo ‘mongod --bind_ip=IP --dbpath=data --nojournal --rest "@"’ > mongod
    $ chmod a+x mongod

  • and after running command ./mongod i got error above.

Can you please help, do you need more information?

Regards,

Austris


#2

Hi Austris.

I think you made a mistake. You are not supposed to cd into data directory. Rest all the step you did is right.

Step 1 - cd out of workspace and run this command

           sudo apt-get install -y mongodb-org.

Step 2 -
mkdir data

Step 3 -
echo ‘mongod --bind_ip=IP --dbpath=data --nojournal --rest "@"’ > mongod

Step 4 -
chmod a+x mongod

Check the docs here-

Regards,
Adithya.S