Nikhil Dhara
Nikhil Dhara

Reputation: 1

ERROR: dbpath (/data/db) does not exist. while trying to create a replica set in onrder to use mongoconnector for elastic search

while trying to create a replica set of db i get an error that dbpath /data/db does not exist.i am currently running mongo in docker as root. version(mongo) 2.6..10. i start using the service mongodb start command after which the mongo shell appears.log below

root@5936a72e744f:/dbex# mongod --replSet myDevReplSet

2017-07-31T05:13:30.946+0000 [initandlisten] MongoDB starting : pid=679 port=27017 dbpath=/data/db 64-bit host=5936a72e744f 2017-07-31T05:13:30.947+0000 [initandlisten] db version v2.6.10 2017-07-31T05:13:30.947+0000 [initandlisten] git version: nogitversion 2017-07-31T05:13:30.947+0000 [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 2017-07-31T05:13:30.947+0000 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58 2017-07-31T05:13:30.948+0000 [initandlisten] allocator: tcmalloc 2017-07-31T05:13:30.949+0000 [initandlisten] options: { replication: { replSet: "myDevReplSet" } } 2017-07-31T05:13:30.950+0000 [initandlisten] exception in initAndListen: 10296


ERROR: dbpath (/data/db) does not exist. Create this directory or give existing directory in --dbpath. See http://dochub.mongodb.org/core/startingandstoppingmongo


, terminating

Upvotes: 0

Views: 2196

Answers (2)

Nikhil Dhara
Nikhil Dhara

Reputation: 1

sometimes the data is stored in var/lib/mongod.

start a replica set use:

mongod --port 27017 --dbpath "/var/lib/mongodb" --replSet rs0

check appropriate location and change dbpath location

Upvotes: 0

Probal
Probal

Reputation: 100

If you have a look into your /etc/mongod.conf you will see

storage:
 dbPath: /data/db

So create directory /data/db and ensure proper permission.

Upvotes: 0

Related Questions