MongoDB server getting disconnected - mongodb

I am getting the following error while running mongod in the terminal(Ubuntu 16.04 LTS).
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] MongoDB starting: pid=4810 port=27017 dbpath=/data/db 64-bit host=Rohan
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] db version v3.2.8
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] git version:ed70e33130c977bda0024c125b56d159573dbaf0
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g-fips 1 Mar 2016
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] modules: none
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] build environment:
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] distmod: ubuntu1604
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] distarch: x86_64
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] target_arch: x86_64
2016-08-16T13:32:14.690+0530 I CONTROL [initandlisten] options: {}
2016-08-16T13:32:14.717+0530 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2016-08-16T13:32:14.717+0530 I - [initandlisten] Fatal Assertion 28578
2016-08-16T13:32:14.717+0530 I - [initandlisten]
***aborting after fassert() failure
Why is this happening?

I have fixed this issue myself, by deleting the mongodb-27017.sock file . I ran the service after deleting this file, which worked fine. However, I am still not sure the root cause of the issue. The output of the command ls - lat /tmp/mongodb-27017.sock is now
srwx------ 1 mongodb nogroup 0 Apr 23 06:24 /tmp/mongodb-27017.sock

Related

Mongod not finding the path of the data directory

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;

Getting error on starting mongodb

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

Unable to start mongdb

2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] MongoDB starting : pid=5716 port=27017 dbpath=/data/db/ 64-bit host=localhost
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] db version v3.2.0
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] allocator: tcmalloc
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] modules: none
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] build environment:
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] distmod: ubuntu1404
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] distarch: x86_64
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] target_arch: x86_64
2017-05-11T12:03:49.700+0530 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db/" } }
2017-05-11T12:03:49.724+0530 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2017-05-11T12:03:49.724+0530 I - [initandlisten] Fatal Assertion 28578
2017-05-11T12:03:49.724+0530 I - [initandlisten]
***aborting after fassert() failure`enter code here`
I am not able to start Mongodb server i tried using service as well and using --dbpath as well i don't know what is the issue. i tried to delete journal files as well but that didn't work
Try to delete the file /tmp/mongodb-27017.sock manually and restart the process.
Have you tried starting it with Sudo from the terminal like so
sudo mongod
this will require your system username and password

Trouble Starting MongoDB (Mac) - Code: 100

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

"mongod" execution terminates immediately

Error that i cant figure out as Im new to using mongoDB... it says that data/db not found and then it terminates..... Do I need to create this folder?
2016-01-27T18:14:41.788+0000 I CONTROL [initandlisten] MongoDB starting : pid=8556 port=27017 dbpath=C:\data\db\ 64-bit host=andrews-hp
2016-01-27T18:14:41.796+0000 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2016-01-27T18:14:41.800+0000 I CONTROL [initandlisten] db version v3.2.1
2016-01-27T18:14:41.803+0000 I CONTROL [initandlisten] git version: a14d55980c2cdc565d4704a7e3ad37e4e535c1b2
2016-01-27T18:14:41.808+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1p-fips 9 Jul 2015
2016-01-27T18:14:41.813+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-27T18:14:41.817+0000 I CONTROL [initandlisten] modules: none
2016-01-27T18:14:41.820+0000 I CONTROL [initandlisten] build environment:
2016-01-27T18:14:41.825+0000 I CONTROL [initandlisten] distmod: 2008plus-ssl
2016-01-27T18:14:41.830+0000 I CONTROL [initandlisten] distarch: x86_64
2016-01-27T18:14:41.834+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-01-27T18:14:41.837+0000 I CONTROL [initandlisten] options: {}
2016-01-27T18:14:41.842+0000 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory C:\data\db\ not found., terminating
2016-01-27T18:14:41.849+0000 I CONTROL [initandlisten] dbexit: rc: 100
Yes you do, I have it under C:.
C:\data\db