问题
I have did the mongodb installation process mentioned in the following link https://docs.mongodb.com/manual/installation/ but i can't start the mongodb this is my log kindly tell me the possible way to start mongo db
C:\>"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
2017-03-12T12:42:55.378+0530 I CONTROL [initandlisten] MongoDB starting : pid=5
400 port=27017 dbpath=C:\data\db\ 64-bit host=vimals
2017-03-12T12:42:55.379+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2017-03-12T12:42:55.380+0530 I CONTROL [initandlisten] db version v3.4.2
2017-03-12T12:42:55.381+0530 I CONTROL [initandlisten] git version: 3f76e40c105
fc223b3e5aac3e20dcd026b83b38b
2017-03-12T12:42:55.382+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL
1.0.1u-fips 22 Sep 2016
2017-03-12T12:42:55.382+0530 I CONTROL [initandlisten] allocator: tcmalloc
2017-03-12T12:42:55.383+0530 I CONTROL [initandlisten] modules: enterprise
2017-03-12T12:42:55.384+0530 I CONTROL [initandlisten] build environment:
2017-03-12T12:42:55.385+0530 I CONTROL [initandlisten] distmod: windows-64
2017-03-12T12:42:55.385+0530 I CONTROL [initandlisten] distarch: x86_64
2017-03-12T12:42:55.386+0530 I CONTROL [initandlisten] target_arch: x86_64
2017-03-12T12:42:55.387+0530 I CONTROL [initandlisten] options: {}
2017-03-12T12:42:55.389+0530 I STORAGE [initandlisten] exception in initAndList
en: 98 Unable to create/open lock file: C:\data\db\mongod.lock The process canno
t access the file because it is being used by another process.. Is a mongod inst
ance already running?, terminating
2017-03-12T12:42:55.390+0530 I NETWORK [initandlisten] shutdown: going to close
listening sockets...
2017-03-12T12:42:55.390+0530 I NETWORK [initandlisten] shutdown: going to flush
diaglog...
2017-03-12T12:42:55.391+0530 I CONTROL [initandlisten] now exiting
2017-03-12T12:42:55.392+0530 I CONTROL [initandlisten] shutting down with code:
100
回答1:
Looks as if your database file is locked by another process, did you try restarting the machine?
回答2:
Just for notes. In my case, after I create db with:
sudo mkdir -p /data/db
I also have to do this:
sudo chmod 777 /data/db
Then the environment is up for running by entering:
mongod
to enter the mongoldb shell.
来源:https://stackoverflow.com/questions/42744961/cannot-start-mongo-db