I am about to start an API project and I have not used Mongodb in quite a while and do not use it everyday, so the context switching it killing me right now because I have used mongod successfully and now cannot remember how to get it up and running.
I tried by simply going to my command line and typing mongod but I get this error:
2016-12-26T11:16:13.285-0500 I CONTROL [initandlisten] MongoDB starting : pid=41005 port=27017 dbpath=/data/db 64-bit host=DCortes-MacBook-Pro-3.local
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] db version v3.4.0
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] allocator: system
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] modules: none
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] build environment:
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] distarch: x86_64
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] target_arch: x86_64
2016-12-26T11:16:13.286-0500 I CONTROL [initandlisten] options: {}
2016-12-26T11:16:13.288-0500 I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating
2016-12-26T11:16:13.288-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2016-12-26T11:16:13.288-0500 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2016-12-26T11:16:13.288-0500 I CONTROL [initandlisten] now exiting
2016-12-26T11:16:13.288-0500 I CONTROL [initandlisten] shutting down with code:100
and I have not been able to identify where in my directory is the error logs. Also, I have perused through Stack Overflow for similar posts but none of them spoke to what exactly is this error I am getting and how to fix it.
Related
I type in mongod to create a new db but I get this error, any idea what's going on here?
mongod
2018-08-28T18:06:36.824+0100 I CONTROL [initandlisten] MongoDB starting : pid=41812 port=27017 dbpath=/data/db 64-bit host=Ruairidhs-MacBook-Pro.local
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] db version v3.6.3
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] allocator: system
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] modules: none
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] build environment:
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] distarch: x86_64
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] target_arch: x86_64
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] options: {}
2018-08-28T18:06:36.825+0100 I STORAGE [initandlisten] exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] now exiting
2018-08-28T18:06:36.825+0100 I CONTROL [initandlisten] shutting down with code:100
Open a new terminal window, and execute top, according to the error, you already have an instance of mongod running, so you need to find it and terminate it.
I'm trying to build a simple CRUD app with a MEAN stack, here's my file tree so far:
-app
-node_modules
-server
-config
-db.js
-controllers
-user.api.js
-models
-user.js
-routes
-api.js
-web.js
-package.json
-server.js
When running mongod I got the following error:
2017-12-03T15:25:53.243-0500 I CONTROL [initandlisten] MongoDB starting : pid=57220 port=27017 dbpath=/data/db 64-bit host=Carloss-MacBook-Pro.local
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] db version v3.4.10
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] git version: 078f28920cb24de0dd479b5ea6c66c644f6326e9
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2m 2 Nov 2017
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] allocator: system
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] modules: none
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] build environment:
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] distarch: x86_64
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] target_arch: x86_64
2017-12-03T15:25:53.244-0500 I CONTROL [initandlisten] options: {}
2017-12-03T15:25:53.247-0500 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2017-12-03T15:25:53.247-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-12-03T15:25:53.247-0500 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-12-03T15:25:53.247-0500 I CONTROL [initandlisten] now exiting
2017-12-03T15:25:53.247-0500 I CONTROL [initandlisten] shutting down with code:100
So I tried to specify the path of my folder to /server/config/db but that still didn't work. Am I writing the path incorrectly?
This is what I have in my db file:
var mongoose = require('mongoose');
var connection = mongoose.connect('mongodb://localhost/mean_db');
module.exports = connection;
I tried to start mongoldb and got error like another instance is running. Closed all other instances, but still getting the same error
$ mongod
2017-06-06T14:10:42.318-0400 I CONTROL [initandlisten] MongoDB starting : pid=22652 port=27017 dbpath=/data/db 64-bit host=IML13C02L80WLF8J2.local
2017-06-06T14:10:42.318-0400 I CONTROL [initandlisten] db version v3.4.0
2017-06-06T14:10:42.318-0400 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] allocator: system
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] modules: none
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] build environment:
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] distarch: x86_64
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] target_arch: x86_64
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] options: {}
2017-06-06T14:10:42.319-0400 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?, terminating
2017-06-06T14:10:42.319-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-06-06T14:10:42.319-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] now exiting
2017-06-06T14:10:42.319-0400 I CONTROL [initandlisten] shutting down with code:100
what I did :
went to the database directory and
mongod --dbpath .
then I got this:
2017-02-16T23:51:51.965+0800 I CONTROL [initandlisten] MongoDB starting : pid=31656 port=27017 dbpath=. 64-bit host=WIN-01604161705
2017-02-16T23:51:51.966+0800 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2017-02-16T23:51:51.968+0800 I CONTROL [initandlisten] db version v3.4.1
2017-02-16T23:51:51.969+0800 I CONTROL [initandlisten] git version: 5e103c4f5583e2566a45d740225dc250baacfbd7
2017-02-16T23:51:51.970+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t-fips 3 May 2016
2017-02-16T23:51:51.971+0800 I CONTROL [initandlisten] allocator: tcmalloc
2017-02-16T23:51:51.972+0800 I CONTROL [initandlisten] modules: none
2017-02-16T23:51:51.973+0800 I CONTROL [initandlisten] build environment:
2017-02-16T23:51:51.974+0800 I CONTROL [initandlisten] distmod: 2008plus-ssl
2017-02-16T23:51:51.975+0800 I CONTROL [initandlisten] distarch: x86_64
2017-02-16T23:51:51.975+0800 I CONTROL [initandlisten] target_arch: x86_64
2017-02-16T23:51:51.978+0800 I CONTROL [initandlisten] options: { storage: { dbPath: "." } }
2017-02-16T23:51:51.982+0800 I - [initandlisten] Detected data files in . created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2017-02-16T23:51:51.982+0800 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3519M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-02-16T23:51:51.992+0800 I - [initandlisten] Assertion: 28595:2: No such file or directory src\mongo\db\storage\wiredtiger\wiredtiger_kv_engine.cpp 267
2017-02-16T23:51:51.992+0800 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-02-16T23:51:51.993+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-02-16T23:51:51.994+0800 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-02-16T23:51:51.996+0800 I CONTROL [initandlisten] now exiting
2017-02-16T23:51:51.998+0800 I CONTROL [initandlisten] shutting down with code:100
I don't know what's going on at all.
all that I have done is just common things like revising my files in other directories, merge the branch 'master' into 'b2' using github client.
I doubt that something went wrong when I did the 'merge' operation.
I have tried using git revert to make it roll back, still getting the same error.
Should I reinstall mongodb? I'm doing so.
I installed MongoDB via Homebrew and seem to be having some trouble starting when I run the mongod command. I have tried setting a up the data/db directory correctly and viewed a few other answers on stackoverflow, but haven't been able to figure this out. Here is what I keep getting (sorry I am new to this):
2017-01-02T23:45:53.444-0500 I CONTROL [initandlisten] MongoDB starting : pid=1419 port=27017 dbpath=/data/db 64-bit host=Johns-MacBook-Pro-3.local
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] db version v3.4.0
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] git version: f4240c60f005be757399042dc12f6addbc3170c1
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] allocator: system
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] modules: none
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] build environment:
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] distarch: x86_64
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] target_arch: x86_64
2017-01-02T23:45:53.445-0500 I CONTROL [initandlisten] options: {}
2017-01-02T23:45:53.446-0500 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7680M,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
2017-01-02T23:45:53.447-0500 E STORAGE [initandlisten] WiredTiger error (2) [1483418753:447985][1419:0x7fffe84c03c0], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: No such file or directory
2017-01-02T23:45:53.457-0500 I - [initandlisten] Assertion: 28595:2: No such file or directory src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 267
2017-01-02T23:45:53.458-0500 I STORAGE [initandlisten] exception in initAndListen: 28595 2: No such file or directory, terminating
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2017-01-02T23:45:53.458-0500 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2017-01-02T23:45:53.458-0500 I CONTROL [initandlisten] now exiting
2017-01-02T23:45:53.458-0500 I CONTROL [initandlisten] shutting down with code:100
Just create directory - /data/db/ on system hdd
This worked for me: sudo mongod --dbpath ~/data/db