Mongod dies upon startup with Fatal Assertion 16252 - mongodb

MongoDB continues to crash upon on a VM I've built. Googled the fatal assertion number to no avail. Any pointers would be appreciated...
Details:
On a VM system running Ubuntu 14.04.
Latest stable mongo packages from 10gen:
# dpkg -l | grep mongo
ii libmongo-client0:amd64 0.1.7-1 amd64 Alternate C driver for the MongoDB document-oriented datastore
ii mongodb-org 2.6.3 amd64 MongoDB open source document-oriented database system (metapackage)
ii mongodb-org-mongos 2.6.3 amd64 MongoDB sharded cluster query router
ii mongodb-org-server 2.6.3 amd64 MongoDB database server
ii mongodb-org-shell 2.6.3 amd64 MongoDB shell client
ii mongodb-org-tools 2.6.3 amd64 MongoDB tools
Plenty of free disk.
Log from /var/log/mongodb/mongod.log:
2014-06-30T16:11:14.474-0600 ***** SERVER RESTARTED *****
2014-06-30T16:11:14.479-0600 [initandlisten] MongoDB starting : pid=27406 port=27017 dbpath=/var/lib/mongodb 64-bit host=foobar
2014-06-30T16:11:14.479-0600 [initandlisten] db version v2.6.3
2014-06-30T16:11:14.479-0600 [initandlisten] git version: 255f67a66f9603c59380b2a389e386910bbb52cb
2014-06-30T16:11:14.479-0600 [initandlisten] build info: Linux build12.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-06-30T16:11:14.479-0600 [initandlisten] allocator: tcmalloc
2014-06-30T16:11:14.479-0600 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-06-30T16:11:14.481-0600 [initandlisten] journal dir=/var/lib/mongodb/journal
2014-06-30T16:11:14.482-0600 [initandlisten] recover begin
2014-06-30T16:11:14.482-0600 [initandlisten] info no lsn file in journal/ directory
2014-06-30T16:11:14.482-0600 [initandlisten] recover lsn: 0
2014-06-30T16:11:14.482-0600 [initandlisten] recover /var/lib/mongodb/journal/j._0
2014-06-30T16:11:14.498-0600 [initandlisten] recover cleaning up
2014-06-30T16:11:14.498-0600 [initandlisten] removeJournalFiles
2014-06-30T16:11:14.500-0600 [initandlisten] recover done
2014-06-30T16:11:14.720-0600 [initandlisten] waiting for connections on port 27017
2014-06-30T16:11:14.751-0600 [IndexRebuilder] Fatal Assertion 16252
2014-06-30T16:11:14.758-0600 [IndexRebuilder] 0x11da801 0x117c9f9 0x115f43d 0xa1a7cf 0xa1ccab 0xa1ced3 0x8f4ad0 0xb89da3 0xb8ac78 0x11625f2 0x121f219 0x7fad84a56182 0x7fad83d5b30d
/usr/bin/mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x11da801]
/usr/bin/mongod(_ZN5mongo10logContextEPKc+0x159) [0x117c9f9]
/usr/bin/mongod(_ZN5mongo13fassertFailedEi+0xcd) [0x115f43d]
/usr/bin/mongod(_ZN5mongo4Lock7DBWrite9lockOtherERKNS_10StringDataE+0xa6f) [0xa1a7cf]
/usr/bin/mongod(_ZN5mongo4Lock7DBWrite6lockDBERKSs+0x17b) [0xa1ccab]
/usr/bin/mongod(_ZN5mongo4Lock7DBWriteC1ERKNS_10StringDataE+0x63) [0xa1ced3]
/usr/bin/mongod(_ZN5mongo6Client12WriteContextC1ERKSsS3_+0x40) [0x8f4ad0]
/usr/bin/mongod(_ZN5mongo14IndexRebuilder7checkNSERKSt4listISsSaISsEE+0xd3) [0xb89da3]
/usr/bin/mongod(_ZN5mongo14IndexRebuilder3runEv+0x188) [0xb8ac78]
/usr/bin/mongod(_ZN5mongo13BackgroundJob7jobBodyEv+0xd2) [0x11625f2]
/usr/bin/mongod() [0x121f219]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182) [0x7fad84a56182]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7fad83d5b30d]
2014-06-30T16:11:14.758-0600 [IndexRebuilder]
***aborting after fassert() failure

Looks like a corrupted journal file or entire database (not sure how that happened?).
move the database files, and restored from a backup dump and all appears to be good.
This happened again after a apt-get upgrade. Wonder if the install script doesn't properly shutdown the database before upgrading, thus corrupting the journal?

Related

Mongodb refuses to connect: shutting down with the code:100

I have just installed Mongodb on my Ubuntu 18 LTS. When I follow the instructions according to the Mongodb Manual, I get some errors in step 3 which is apt update:
Err:11 http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 InRelease
403 Forbidden [IP: 143.204.209.210 80]
Err:12 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 InRelease
403 Forbidden [IP: 143.204.209.210 443]
After much trying, I finally installed mongodb with this command,(I removed -org):
sudo apt-get install -y mongodb
after that, I started Mongodb without any errors:
sudo service mongodb start
then I checked the status and everything seems to be fine:
mongodb.service - An object/document-oriented database
Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset:
Active: active (running) since Thu 2020-04-16 10:32:29 +0430; 25min ago
Docs: man:mongod(1)
Main PID: 1066 (mongod)
Tasks: 23 (limit: 4418)
CGroup: /system.slice/mongodb.service
└─1066 /usr/bin/mongod --unixSocketPrefix=/run/mongodb --config /etc/
But the problem is when I type "mongod" in my Terminal, I encounter the error code:100 though I have my dbpath:
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] MongoDB starting : pid=4353 port=27017 dbpath=/data/db 64-bit host=ata-Aspire-E1-571G
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] db version v3.6.3
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] allocator: tcmalloc
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] modules: none
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] build environment:
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] distarch: x86_64
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] target_arch: x86_64
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] options: {}
2020-04-16T11:14:05.161+0430 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] now exiting
2020-04-16T11:14:05.161+0430 I CONTROL [initandlisten] shutting down with code:100
Does anyone have any idea what my problem is? I checked the previous talks but found nothing on this.
Another thing I have to report is that I use Sudo before mongod but get the same error with mongod.
While you could repair your existing installation, the log output indicates that you installed 3.6 which is 2 versions out of date (current version is 4.2), and is not even the most recent 3.6 release which is 3.6.17. So I suggest you follow the instructions again and prior to doing that, remove any existing files with names like /etc/apt/sources.list.d/mongodb-org-4.2.list that you may have and remove any installed MongoDB packages.
Finally I installed my Mongodb via changing my DNS because of sanctions problem. Now, I have my mongodb installed but when I type "mongod" in my Ubuntu terminal I get this:
2020-04-17T12:38:01.073+0430 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-04-17T12:38:01.078+0430 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] MongoDB starting : pid=2476 port=27017 dbpath=/data/db 64-bit host=ata-Aspire-E1-571G
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] db version v4.2.5
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] git version: 2261279b51ea13df08ae708ff278f0679c59dc32
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] allocator: tcmalloc
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] modules: none
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] build environment:
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] distmod: ubuntu1804
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] distarch: x86_64
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] target_arch: x86_64
2020-04-17T12:38:01.078+0430 I CONTROL [initandlisten] options: {}
2020-04-17T12:38:01.079+0430 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted
2020-04-17T12:38:01.079+0430 F - [initandlisten] Fatal Assertion 40486 at src/mongo/transport/transport_layer_asio.cpp 684
2020-04-17T12:38:01.079+0430 F - [initandlisten]
***aborting after fassert() failure
And then when I re-run it with the commadand "sudo mongod" I encounter:
2020-04-17T12:42:30.535+0430 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-04-17T12:42:30.536+0430 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] MongoDB starting : pid=2514 port=27017 dbpath=/data/db 64-bit host=ata-Aspire-E1-571G
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] db version v4.2.5
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] git version: 2261279b51ea13df08ae708ff278f0679c59dc32
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] allocator: tcmalloc
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] modules: none
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] build environment:
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] distmod: ubuntu1804
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] distarch: x86_64
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] target_arch: x86_64
2020-04-17T12:42:30.537+0430 I CONTROL [initandlisten] options: {}
2020-04-17T12:42:30.537+0430 E STORAGE [initandlisten] Failed to set up listener: SocketException: Address already in use
2020-04-17T12:42:30.552+0430 I CONTROL [initandlisten] now exiting
2020-04-17T12:42:30.552+0430 I CONTROL [initandlisten] shutting down with code:48
when I type "sudo systemctl status mongodb", I get this:
Unit mongodb.service could not be found.
But, when I enter this command I get the proper answer:
"mongo --eval 'db.runCommand({ connectionStatus: 1 })'"
MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("a24c786b-d161-4c3c-91bd-a55198d72505") }
MongoDB server version: 4.2.5
{
"authInfo" : {
"authenticatedUsers" : [ ],
"authenticatedUserRoles" : [ ]
},
"ok" : 1
}
Now, I was wondered what the problem could be?
I think I finally got my answer. Here there are some problems that may cause problems:
1.Uninstalling Mongodb completely is very important. You should remove every each of folders. For this, you can use Mongodb Uninstalling instructions.
For those who had the same problem as me, Forbidden access is sth for countries which are under sanctions and will not access to the targeted website unless you change your DNS or use Proxies. Otherwise you won't get access to anything.
3.If the previous step is met, then we can follow the instructions in Mongodb website in order to install your Mongodb.
**** An important thing is sometimes we need to change our IP connection in Configuration of Mongodb ****
Having Mongodb installed in your Computer, a reboot(restart) may be needed. After a restart the system may work correctly.
For running Mongodb in your Terminal type :
Mongod and if it didn't work, try "sudo mongod"
And finally we can enjoy our Mongodb.
Goodluck!

MongoDB 4.2 doesnt start on ubuntu 18.04 after reinstall - process immediately stops

I have problem with mongoDB - I going step by step with official tutorial:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
Also I installed through this answer( of course I changed some commands to download 4.2 not 4.0 like it is in this answer): https://askubuntu.com/questions/842592/apt-get-fails-on-16-04-or-18-04-installing-mongodb/842599#842599
But afterall it still doesnt work:
adrian#ubuntu:~$ sudo service mongod start
adrian#ubuntu:~$ sudo service mongod status
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-09-26 09:37:53 CEST; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 5220 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=62)
Main PID: 5220 (code=exited, status=62)
Sep 26 09:37:51 ubuntu systemd[1]: Started MongoDB Database Server.
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Main process exited, code=exited, status=62/n/a
Sep 26 09:37:53 ubuntu systemd[1]: mongod.service: Failed with result 'exit-code'.
Even when I try to investigate mongo logs it still doesnt tell me much:
adrian#ubuntu:~$ sudo tail -n 100 /var/log/mongodb/mongod.log
2019-09-26T09:37:51.893+0200 I CONTROL [main] ***** SERVER RESTARTED *****
2019-09-26T09:37:51.895+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] MongoDB starting : pid=5220 port=27017 dbpath=/var/lib/mongodb 64-bit host=ubuntu
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] db version v4.2.0
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] allocator: tcmalloc
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] modules: none
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] build environment:
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] distmod: ubuntu1804
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] distarch: x86_64
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] target_arch: x86_64
2019-09-26T09:37:51.901+0200 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] Detected data files in /var/lib/mongodb created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten]
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2019-09-26T09:37:51.901+0200 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=11527M,cache_overflow=(file_max=0M),session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2019-09-26T09:37:52.400+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:400536][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.460+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:460670][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.544+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:544472][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 20/896 to 21/256
2019-09-26T09:37:52.607+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:607556][5220:0x7fc6c8d05b00], txn-recover: Recovering log 20 through 21
2019-09-26T09:37:52.643+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:643077][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 21
2019-09-26T09:37:52.669+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:669301][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:52.677+0200 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-09-26T09:37:52.682+0200 I STORAGE [initandlisten] Timestamp monitor starting
2019-09-26T09:37:52.683+0200 I CONTROL [initandlisten]
2019-09-26T09:37:52.683+0200 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-09-26T09:37:52.684+0200 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-09-26T09:37:52.684+0200 I CONTROL [initandlisten]
2019-09-26T09:37:52.698+0200 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2019-09-26T09:37:52.698+0200 F CONTROL [initandlisten] ** IMPORTANT: UPGRADE PROBLEM: Found an invalid featureCompatibilityVersion document (ERROR: BadValue: Invalid value for version, found 3.6, expected '4.2' or '4.0'. Contents of featureCompatibilityVersion document in admin.system.version: { _id: "featureCompatibilityVersion", version: "3.6" }. See http://dochub.mongodb.org/core/4.0-feature-compatibility.). If the current featureCompatibilityVersion is below 4.0, see the documentation on upgrading at http://dochub.mongodb.org/core/4.0-upgrade-fcv.
2019-09-26T09:37:52.698+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-09-26T09:37:52.698+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-26T09:37:52.698+0200 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] Deregistering all the collections
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] Timestamp monitor shutting down
2019-09-26T09:37:52.698+0200 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Finished shutting down session sweeper thread
2019-09-26T09:37:52.699+0200 I STORAGE [initandlisten] Shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Finished shutting down journal flusher thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Finished shutting down checkpoint thread
2019-09-26T09:37:52.779+0200 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2019-09-26T09:37:52.808+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:808033][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.848+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:848763][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:52.891+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:891333][5220:0x7fc6c8d05b00], txn-recover: Main recovery loop: starting at 21/3328 to 22/256
2019-09-26T09:37:52.944+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:944712][5220:0x7fc6c8d05b00], txn-recover: Recovering log 21 through 22
2019-09-26T09:37:52.977+0200 I STORAGE [initandlisten] WiredTiger message [1569483472:977288][5220:0x7fc6c8d05b00], txn-recover: Recovering log 22 through 22
2019-09-26T09:37:53.003+0200 I STORAGE [initandlisten] WiredTiger message [1569483473:3143][5220:0x7fc6c8d05b00], txn-recover: Set global recovery timestamp: (0,0)
2019-09-26T09:37:53.023+0200 I STORAGE [initandlisten] shutdown: removing fs lock...
2019-09-26T09:37:53.023+0200 I CONTROL [initandlisten] now exiting
2019-09-26T09:37:53.023+0200 I CONTROL [initandlisten] shutting down with code:62
I will be very grateful for any advice
Remove complete mongodb from your ubuntu
sudo apt-get purge mongo* // or sudo apt remove mongo*
sudo apt-get purge mongodb-org*
Backup your database and remove log and data using folder
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
Now install again with this
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc \
sudo apt-key add -
Add sources
$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" \
sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
Then install mongodb package again
sudo apt-get install -y mongodb-org=4.2.0 \
mongodb-org-server=4.2.0 \
mongodb-org-shell=4.2.0 \
mongodb-org-mongos=4.2.0 \
mongodb-org-tools=4.2.0
Start service using mongodb
$ systemctl enable mongod.service
$ sudo service mongod start
Or Follow this doc installation process
i also have this issue, i solved by change the bindIp in mongo config
On Linux, a default /etc/mongod.conf configuration file is included
when using a package manager to install MongoDB.
sudo nano /etc/mongod.conf
then edit the bindIP to
bindIp: [127.0.0.1, X.X.X.X]
Then restart mongodb .
sudo service mongod stop
sudo service mongod start

mongodump gives segmentation fault

I have MongoDB v3.2.6 installed on my mac macOs High Sierra v10.13.1 and I am trying to make a backup before I upgrade.
I have an instance of $ mongod running in one window using defaut db location and default port.
It is my local database, it is not protected by a password and does not require ssl conncetions.
I can access my databases find using $ mongo or Robomongo but when I run $ mongodump or $ mongodump --db mydatabase I get the following error
[1] 1815 segmentation fault mongodump
UPDATE: I have tried to run mongostat and now I get the following error :
[1] 2404 bus error mongodump
Here is the log I get when starting the db with $ mongod :
2017-12-25T12:36:26.642+0000 I CONTROL [initandlisten] MongoDB starting : pid=3216 port=27017 dbpath=/data/db 64-bit host=MBP-de-Kevin.home
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] db version v3.2.6
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] git version: 05552b562c7a0b3143a729aaa0838e558dc49b25
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2m 2 Nov 2017
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] allocator: system
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] modules: none
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] build environment:
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] distarch: x86_64
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] target_arch: x86_64
2017-12-25T12:36:26.643+0000 I CONTROL [initandlisten] options: {}
2017-12-25T12:36:26.644+0000 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the active storage engine to 'mmapv1'.
2017-12-25T12:36:26.653+0000 I JOURNAL [initandlisten] journal dir=/data/db/journal
2017-12-25T12:36:26.654+0000 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2017-12-25T12:36:26.674+0000 I JOURNAL [durability] Durability thread started
2017-12-25T12:36:26.675+0000 I JOURNAL [journal writer] Journal writer thread started
2017-12-25T12:36:26.894+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2017-12-25T12:36:26.894+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
2017-12-25T12:36:26.894+0000 I NETWORK [initandlisten] waiting for connections on port 27017
What am I doing wrong and How can I debug?
I was experiencing the same problem. I am on macOS High Sierra 10.13.3. My mongo version was mongodb 3.2.7. I read this in the documentation of mongodump:
MAC OSX SIERRA AND GO 1.6 INCOMPATIBILITY
Users running on Mac OSX Sierra require the 3.2.10 or newer version of mongodump.
I upgraded to mongodb 3.6.2 and I my issue was resolved.
I fixed my error using brew upgrade mongodb. Still dont know what was the issue.
That said it is better to follow one of these guide upgrade mongodb to avoid other issues.

cannot run local mongo server on OSX

Good day,
I used to be able to run mongo server on localhost from the shell with the command mongod --config /usr/local/etc/mongod.conf but unfortunately now the command silently fails.
if I try which mongod I will get /usr/local/bin/mongod. I have tried restarting my machine and doing brew uninstall mongodb followed by brew install mongodb but I get the same effect.
The contents of my config file located at /usr/local/etc/mongod.conf are as follows:
systemLog:
destination: file
path: /usr/local/var/log/mongodb/mongo.log
logAppend: true
storage:
dbPath: /usr/local/var/mongodb
net:
bindIp: 127.0.0.1
By the way if I try to run mongod without the --config option I get the following errors:
2016-11-28T11:01:01.288-0500 I CONTROL [initandlisten] MongoDB starting : pid=4895 port=27017 dbpath=/data/db 64-bit host=Danials-MacBook-Pro.local
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] db version v3.2.11
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] git version: 009580ad490190ba33d1c6253ebd8d91808923e4
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2j 26 Sep 2016
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] allocator: system
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] modules: none
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] build environment:
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] distarch: x86_64
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] target_arch: x86_64
2016-11-28T11:01:01.289-0500 I CONTROL [initandlisten] options: {}
2016-11-28T11:01:01.290-0500 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating
2016-11-28T11:01:01.290-0500 I CONTROL [initandlisten] dbexit: rc: 100
Thanks
Log file clearly says that the data directory /data/db not found..
Please create the directory for data and start the mongod process.
In your case,the value given to the dbPath in your config file is the data folder.

Fatal Assertion in MongoDB

I have been uninstalling and reinstalling Mongodb on Ubuntu 14.04 following the official documentation for few times now. However, I keep getting this:
2015-12-22T12:46:32.091+0000 I CONTROL ***** SERVER RESTARTED *****
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] MongoDB starting : pid=7039 port=27017 dbpath=/var/lib/mongodb 64-bit host=server-04
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] db version v3.0.8
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] git version: 83d8cc25e00e42856924d84e220fbe4a839e605d
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] build info: Linux ip-10-187-89-126 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] allocator: tcmalloc
2015-12-22T12:46:32.096+0000 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, syste$
2015-12-22T12:46:32.120+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2015-12-22T12:46:32.120+0000 I - [initandlisten] Fatal Assertion 28578
2015-12-22T12:46:32.120+0000 I - [initandlisten]
***aborting after fassert() failure
I am expecting to see: [initandlisten] waiting for connections on port <port> but can't see it. What can cause it?
remove everything from /tmp directory
sudo rm -rf /tmp/mongod*.sock
change the ownership of the db path and log path
chown -R mongodb:mongodb /var/lib/mongodb/
chown -R mongodb:mongodb /var/log/monogdb/
restart your mongo
sudo service mongod start