Reputation: 1
This is what happens after running the command $ mongod -dbpath /var/lib/mongodb/data/db
:
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] MongoDB
starting : pid=4346 port=27017 dbpath=/var/lib/mongodb/data/db 64-bit host=era-Inspiron-5559
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] db version v3.4.2
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] modules: none
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] build environment:
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] distmod: ubuntu1604
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] distarch: x86_64
2017-02-12T14:39:18.644+0530 I CONTROL [initandlisten]
target_arch: x86_642017-02-12T14:39:18.644+0530 I CONTROL [initandlisten] options: { storage: { dbPath: "/var/lib/mongodb/data/db" } }
2017-02-12T14:39:18.645+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /var/lib/mongodb/data/db not found., terminating
2017-02-12T14:39:18.645+0530 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-02-12T14:39:18.645+0530 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-02-12T14:39:18.645+0530 I CONTROL [initandlisten] now exiting
2017-02-12T14:39:18.645+0530 I CONTROL [initandlisten] shutting down with code:100
Please help.
Upvotes: 0
Views: 289
Reputation: 812
/data/db
is the default ( i.e. with no conf file )
/var/lib/mongodb
is how it is configured in many distributions via the /etc/mongodb.conf
file.
Before doing any of the other solutions see my answer here.
Maybe your conf file is being rejected due to outdated options or format changes.
Upvotes: 0
Reputation: 4435
You may need to follow following procedure:
mkdir -p /var/lib/mongodb/data/db
sudo chown mongodb:mongodb /var/lib/mongodb/data/db/ -R
mongod -dbpath /var/lib/mongodb/data/db
Upvotes: 0