Score:0

mongod cmd won't connect after downloading MongoDB

br flag

I have an issue where I cannot connect to the MongoDB server using the cmd mongod after downloading MongoDB.

this is what the terminal shows when using mongod:

$ mongod
{"t":{"$date":"2021-11-29T19:51:43.327-08:00"},"s":"I",  "c":"NETWORK",  "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":13},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":13},"outgoing":{"minWireVersion":0,"maxWireVersion":13},"isInternalClient":true}}}
{"t":{"$date":"2021-11-29T19:51:43.330-08:00"},"s":"I",  "c":"CONTROL",  "id":23285,   "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-11-29T19:51:43.330-08:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-11-29T19:51:43.330-08:00"},"s":"I",  "c":"NETWORK",  "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"W",  "c":"ASIO",     "id":22601,   "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"REPL",     "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"CONTROL",  "id":5945603, "ctx":"main","msg":"Multi threading initialized"}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"CONTROL",  "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":24007,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"Lufarius777"}}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"CONTROL",  "id":23403,   "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"5.0.4","gitVersion":"62a84ede3cc9a334e8bc82160714df71e7d3a29e","openSSLVersion":"OpenSSL 1.1.1f  31 Mar 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu2004","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"CONTROL",  "id":51765,   "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Ubuntu","version":"20.04"}}}
{"t":{"$date":"2021-11-29T19:51:43.332-08:00"},"s":"I",  "c":"CONTROL",  "id":21951,   "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{}}}
{"t":{"$date":"2021-11-29T19:51:43.333-08:00"},"s":"I",  "c":"STORAGE",  "id":22270,   "ctx":"initandlisten","msg":"Storage engine to use detected by data files","attr":{"dbpath":"/data/db","storageEngine":"wiredTiger"}}
{"t":{"$date":"2021-11-29T19:51:43.333-08:00"},"s":"I",  "c":"STORAGE",  "id":22297,   "ctx":"initandlisten","msg":"Using the XFS filesystem is strongly recommended with the WiredTiger storage engine. See http://dochub.mongodb.org/core/prodnotes-filesystem","tags":["startupWarnings"]}
{"t":{"$date":"2021-11-29T19:51:43.333-08:00"},"s":"I",  "c":"STORAGE",  "id":22315,   "ctx":"initandlisten","msg":"Opening WiredTiger","attr":{"config":"create,cache_size=2424M,session_max=33000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),builtin_extension_config=(zstd=(compression_level=6)),file_manager=(close_idle_time=600,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress,compact_progress],"}}
{"t":{"$date":"2021-11-29T19:51:43.993-08:00"},"s":"W",  "c":"STORAGE",  "id":22347,   "ctx":"initandlisten","msg":"Failed to start up WiredTiger under any compatibility version. This may be due to an unsupported upgrade or downgrade."}
{"t":{"$date":"2021-11-29T19:51:43.993-08:00"},"s":"F",  "c":"STORAGE",  "id":28595,   "ctx":"initandlisten","msg":"Terminating.","attr":{"reason":"95: Operation not supported"}}
{"t":{"$date":"2021-11-29T19:51:43.993-08:00"},"s":"F",  "c":"-",        "id":23091,   "ctx":"initandlisten","msg":"Fatal assertion","attr":{"msgid":28595,"file":"src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp","line":687}}
{"t":{"$date":"2021-11-29T19:51:43.993-08:00"},"s":"F",  "c":"-",        "id":23092,   "ctx":"initandlisten","msg":"\n\n***aborting after fassert() failure\n\n"}

I've tried uninstalling/purging and reinstalling MongoDB numerous times. I am able to connect after the following...

un-installing MongoDB...

sudo service mongod stop
sudo apt-get purge mongodb-org*
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove

un-installing Compass...

sudo dpkg --remove mongodb-compass

I then go to the MongoDB documentation to install: "MongodDB Community Edition for Ubuntu", specifically 20.0.04 LTS ("Focal") ... which I have

nick@777:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

I do the following from the documentation...

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -

echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list

sudo apt-get update

sudo apt-get install -y mongodb-org

mongod-db installation output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  mongodb-database-tools mongodb-mongosh mongodb-org-database mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell
  mongodb-org-tools
The following NEW packages will be installed:
  mongodb-database-tools mongodb-mongosh mongodb-org mongodb-org-database mongodb-org-database-tools-extra mongodb-org-mongos mongodb-org-server mongodb-org-shell
  mongodb-org-tools
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/147 MB of archives.
After this operation, 467 MB of additional disk space will be used.
Selecting previously unselected package mongodb-database-tools.
(Reading database ... 254976 files and directories currently installed.)
Preparing to unpack .../0-mongodb-database-tools_100.5.1_amd64.deb ...
Unpacking mongodb-database-tools (100.5.1) ...
Selecting previously unselected package mongodb-mongosh.
Preparing to unpack .../1-mongodb-mongosh_1.1.4_amd64.deb ...
Unpacking mongodb-mongosh (1.1.4) ...
Selecting previously unselected package mongodb-org-shell.
Preparing to unpack .../2-mongodb-org-shell_5.0.4_amd64.deb ...
Unpacking mongodb-org-shell (5.0.4) ...
Selecting previously unselected package mongodb-org-server.
Preparing to unpack .../3-mongodb-org-server_5.0.4_amd64.deb ...
Unpacking mongodb-org-server (5.0.4) ...
Selecting previously unselected package mongodb-org-mongos.
Preparing to unpack .../4-mongodb-org-mongos_5.0.4_amd64.deb ...
Unpacking mongodb-org-mongos (5.0.4) ...
Selecting previously unselected package mongodb-org-database-tools-extra.
Preparing to unpack .../5-mongodb-org-database-tools-extra_5.0.4_amd64.deb ...
Unpacking mongodb-org-database-tools-extra (5.0.4) ...
Selecting previously unselected package mongodb-org-database.
Preparing to unpack .../6-mongodb-org-database_5.0.4_amd64.deb ...
Unpacking mongodb-org-database (5.0.4) ...
Selecting previously unselected package mongodb-org-tools.
Preparing to unpack .../7-mongodb-org-tools_5.0.4_amd64.deb ...
Unpacking mongodb-org-tools (5.0.4) ...
Selecting previously unselected package mongodb-org.
Preparing to unpack .../8-mongodb-org_5.0.4_amd64.deb ...
Unpacking mongodb-org (5.0.4) ...
Setting up mongodb-mongosh (1.1.4) ...
Setting up mongodb-org-server (5.0.4) ...
Adding system user `mongodb' (UID 128) ...
Adding new user `mongodb' (UID 128) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
addgroup: The group `mongodb' already exists as a system group. Exiting.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
Setting up mongodb-org-shell (5.0.4) ...
Setting up mongodb-database-tools (100.5.1) ...
Setting up mongodb-org-mongos (5.0.4) ...
Setting up mongodb-org-database-tools-extra (5.0.4) ...
Setting up mongodb-org-database (5.0.4) ...
Setting up mongodb-org-tools (5.0.4) ...
Setting up mongodb-org (5.0.4) ...
Processing triggers for man-db (2.9.1-1)

...

verify the mongod version using mongod --version

    db version v5.0.4
Build Info: {
    "version": "5.0.4",
    "gitVersion": "62a84ede3cc9a334e8bc82160714df71e7d3a29e",
    "openSSLVersion": "OpenSSL 1.1.1f  31 Mar 2020",
    "modules": [],
    "allocator": "tcmalloc",
    "environment": {
        "distmod": "ubuntu2004",
        "distarch": "x86_64",
        "target_arch": "x86_64"
    }
}

I also get this Output when checking the status with sudo systemctl status mongod

    sudo systemctl status mongod
● mongod.service - MongoDB Database Server
     Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2021-11-29 20:24:04 PST; 5s ago
       Docs: https://docs.mongodb.org/manual
    Process: 32312 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
   Main PID: 32312 (code=exited, status=14)

Nov 29 20:24:04 Lufarius777 systemd[1]: Started MongoDB Database Server.
Nov 29 20:24:04 Lufarius777 systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Nov 29 20:24:04 Lufarius777 systemd[1]: mongod.service: Failed with result 'exit-code'.

I honestly don't know if the terminal is showing the correct output for the command mongod

I've also tried stopping/restarting the service with the following

sudo systemctl stop mongod

sudo systemctl restart mongod

any Help would be SUPER helpful to put this nightmare to an end, thank you!

chovy avatar
in flag
I'm having same problem going from default 3.6 to 5.09
Score:0
es flag

Create a directory /data/db in your root directory (computer folder). then start MongoDB withsudo mongod

hope this helps

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.