I tried to start mongod and got this error
forked process: 4271
ERROR: child process failed, exited with error number 62
To see additional information in this output, start without the "--fork" option.
I retried with sudo mongod and got this instead
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] MongoDB starting : pid=4275 port=27017 dbpath=/data/db 64-bit host=dhcp020-218-083.wireless.buffalo.edu
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] db version v4.2.1
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] git version: edf6d45851c0b9ee15548f0f847df141764a317e
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] allocator: system
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] modules: none
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] build environment:
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] distarch: x86_64
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] target_arch: x86_64
2019-11-26T12:54:27.563-0500 I CONTROL [initandlisten] options: {}
2019-11-26T12:54:27.564-0500 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2019-11-26T12:54:27.564-0500 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7680M,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,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2019-11-26T12:54:28.082-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:81997][4275:0x114a835c0], txn-recover: Recovering log 35 through 36
2019-11-26T12:54:28.131-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:131917][4275:0x114a835c0], txn-recover: Recovering log 36 through 36
2019-11-26T12:54:28.180-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:180756][4275:0x114a835c0], txn-recover: Main recovery loop: starting at 35/896 to 36/256
2019-11-26T12:54:28.259-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:259184][4275:0x114a835c0], txn-recover: Recovering log 35 through 36
2019-11-26T12:54:28.306-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:306249][4275:0x114a835c0], txn-recover: Recovering log 36 through 36
2019-11-26T12:54:28.345-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:345839][4275:0x114a835c0], txn-recover: Set global recovery timestamp: (0,0)
2019-11-26T12:54:28.399-0500 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2019-11-26T12:54:28.405-0500 I STORAGE [initandlisten] Timestamp monitor starting
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten]
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten]
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten]
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten]
2019-11-26T12:54:28.405-0500 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2019-11-26T12:54:28.407-0500 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2019-11-26T12:54:28.408-0500 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-11-26T12:54:28.408-0500 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-11-26T12:54:28.408-0500 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-11-26T12:54:28.408-0500 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] Deregistering all the collections
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] Timestamp monitor shutting down
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] Shutting down session sweeper thread
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] Finished shutting down session sweeper thread
2019-11-26T12:54:28.408-0500 I STORAGE [initandlisten] Shutting down journal flusher thread
2019-11-26T12:54:28.499-0500 I STORAGE [initandlisten] Finished shutting down journal flusher thread
2019-11-26T12:54:28.500-0500 I STORAGE [initandlisten] Shutting down checkpoint thread
2019-11-26T12:54:28.500-0500 I STORAGE [initandlisten] Finished shutting down checkpoint thread
2019-11-26T12:54:28.500-0500 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2019-11-26T12:54:28.576-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:576019][4275:0x114a835c0], txn-recover: Recovering log 36 through 37
2019-11-26T12:54:28.615-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:615152][4275:0x114a835c0], txn-recover: Recovering log 37 through 37
2019-11-26T12:54:28.666-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:666135][4275:0x114a835c0], txn-recover: Main recovery loop: starting at 36/2048 to 37/256
2019-11-26T12:54:28.744-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:744560][4275:0x114a835c0], txn-recover: Recovering log 36 through 37
2019-11-26T12:54:28.790-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:790388][4275:0x114a835c0], txn-recover: Recovering log 37 through 37
2019-11-26T12:54:28.831-0500 I STORAGE [initandlisten] WiredTiger message [1574790868:831263][4275:0x114a835c0], txn-recover: Set global recovery timestamp: (0,0)
2019-11-26T12:54:28.964-0500 I STORAGE [initandlisten] shutdown: removing fs lock...
2019-11-26T12:54:28.965-0500 I CONTROL [initandlisten] now exiting
2019-11-26T12:54:28.965-0500 I CONTROL [initandlisten] shutting down with code:62```
I already checked to see if I have a /data/db folder and I do, I tried to delete the data folder and recreate it with no luck. I checked on the forums and error code 62 means that the data/db folder is on a different version than the MongoDB installation, I'm not sure how I would go about fixing this error.
Related
After running mongod and mongo in terminal
$mongo
MongoDB shell version v4.2.6
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("707b65a3-c675-4b03-a386-21c5d589c05f") }
MongoDB server version: 4.2.6
and nothing happens! I am unable to create a new database. Please Help!
In another terminal
$ mongod
2020-06-28T20:52:27.841+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-06-28T20:52:28.502+0530 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] MongoDB starting : pid=14576 port=27017 dbpath=E:\data\db\ 64-bit host=BTL
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] db version v4.2.6
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] git version: 20364840b8f1af16917e4c23c1b5f5efd8b352f8
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] allocator: tcmalloc
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] modules: none
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] build environment:
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] distmod: 2012plus
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] distarch: x86_64
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] target_arch: x86_64
2020-06-28T20:52:28.504+0530 I CONTROL [initandlisten] options: {}
2020-06-28T20:52:28.512+0530 W STORAGE [initandlisten] Detected unclean shutdown - E:\data\db\mongod.lock is not empty.
2020-06-28T20:52:28.514+0530 I STORAGE [initandlisten] Detected data files in E:\data\db\ created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2020-06-28T20:52:28.514+0530 W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
2020-06-28T20:52:28.514+0530 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1491M,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,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2020-06-28T20:52:28.889+0530 I STORAGE [initandlisten] WiredTiger message [1593357748:888613][14576:140705565789264], txn-recover: Recovering log 3 through 4
2020-06-28T20:52:29.105+0530 I STORAGE [initandlisten] WiredTiger message [1593357749:104639][14576:140705565789264], txn-recover: Recovering log 4 through 4
2020-06-28T20:52:29.382+0530 I STORAGE [initandlisten] WiredTiger message [1593357749:381648][14576:140705565789264], txn-recover: Main recovery loop: starting at 3/5632 to 4/256
2020-06-28T20:52:29.885+0530 I STORAGE [initandlisten] WiredTiger message [1593357749:884866][14576:140705565789264], txn-recover: Recovering log 3 through 4
2020-06-28T20:52:30.476+0530 I STORAGE [initandlisten] WiredTiger message [1593357750:475971][14576:140705565789264], txn-recover: Recovering log 4 through 4
2020-06-28T20:52:30.693+0530 I STORAGE [initandlisten] WiredTiger message [1593357750:692960][14576:140705565789264], txn-recover: Set global recovery timestamp: (0, 0)
2020-06-28T20:52:33.168+0530 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2020-06-28T20:52:36.667+0530 I STORAGE [initandlisten] Timestamp monitor starting
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten]
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten]
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2020-06-28T20:52:37.172+0530 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2020-06-28T20:52:37.173+0530 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2020-06-28T20:52:37.173+0530 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2020-06-28T20:52:37.173+0530 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2020-06-28T20:52:37.173+0530 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2020-06-28T20:52:37.173+0530 I CONTROL [initandlisten]
2020-06-28T20:52:42.495+0530 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2020-06-28T20:52:44.701+0530 I STORAGE [initandlisten] Flow Control is enabled on this deployment.
2020-06-28T20:52:45.029+0530 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
2020-06-28T20:52:45.348+0530 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
2020-06-28T20:52:47.258+0530 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
2020-06-28T20:52:51.373+0530 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory 'E:/data/db/diagnostic.data'
2020-06-28T20:52:51.410+0530 I SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>
2020-06-28T20:52:51.411+0530 I NETWORK [listener] Listening on 127.0.0.1
2020-06-28T20:52:51.411+0530 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>
2020-06-28T20:52:51.411+0530 I NETWORK [listener] waiting for connections on port 27017
2020-06-28T20:52:52.042+0530 I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
2020-06-28T20:52:52.520+0530 I SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded>
Mongod has been running as v4 for several months. It is used to record clinical data for patient with neurological diseases, and is essential to the drug trials.
This morning mongo crashed, and upon restarting, mongod refuses to start, on a collection that has a missing UUID. The message is cryptic, as this is not a 3.6 DB. Is there a way to proceed? The sensorTag collection is not really essential, and erasing it would be OK. Is there a way to get mongod to use the DB at all?
Here is the startup message:
2020-05-18T23:23:58.587+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] MongoDB starting : pid=1526 port=23417 dbpath=./db 64-bit host=retro-4-10-19
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] db version v4.0.18
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] git version: 6883bdfb8b8cff32176b1fd176df04da9165fd67
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] modules: none
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] build environment:
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] distmod: ubuntu1804
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] distarch: x86_64
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-05-18T23:23:58.590+0000 I CONTROL [initandlisten] options: { net: { bindIp: "127.0.0.1", port: 23417 }, storage: { dbPath: "./db" } }
2020-05-18T23:23:58.591+0000 I STORAGE [initandlisten] Detected data files in ./db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2020-05-18T23:23:58.591+0000 I STORAGE [initandlisten]
2020-05-18T23:23:58.591+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-05-18T23:23:58.591+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-05-18T23:23:58.591+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=484M,cache_overflow=(file_max=0M),session_max=20000,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),
2020-05-18T23:23:59.519+0000 I STORAGE [initandlisten] WiredTiger message [1589844239:519947][1526:0x7fa98a9fca40], txn-recover: Main recovery loop: starting at 46/768 to 47/256
2020-05-18T23:23:59.635+0000 I STORAGE [initandlisten] WiredTiger message [1589844239:635147][1526:0x7fa98a9fca40], txn-recover: Recovering log 46 through 47
2020-05-18T23:23:59.703+0000 I STORAGE [initandlisten] WiredTiger message [1589844239:703356][1526:0x7fa98a9fca40], txn-recover: Recovering log 47 through 47
2020-05-18T23:23:59.767+0000 I STORAGE [initandlisten] WiredTiger message [1589844239:767605][1526:0x7fa98a9fca40], txn-recover: Set global recovery timestamp: 0
2020-05-18T23:23:59.794+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2020-05-18T23:23:59.807+0000 I CONTROL [initandlisten]
2020-05-18T23:23:59.807+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-05-18T23:23:59.807+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-05-18T23:23:59.807+0000 I CONTROL [initandlisten]
2020-05-18T23:23:59.823+0000 F CONTROL [initandlisten] ** IMPORTANT: Collection RetrotopeClinic.sensortags is missing an UUID. We expect all collections to have UUIDs starting in FCV 3.6. Please make sure the FCV is version 3.6 before attempting an upgrade to 4.0; see http://dochub.mongodb.org/core/4.0-upgrade-fcv for more details. If the FCV is already 3.6, please try --repair with a 3.6 binary or initial sync to fix the data files.
2020-05-18T23:23:59.823+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-05-18T23:23:59.823+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-23417.sock
2020-05-18T23:23:59.823+0000 I STORAGE [initandlisten] WiredTigerKVEngine shutting down
2020-05-18T23:23:59.823+0000 I STORAGE [initandlisten] Shutting down session sweeper thread
2020-05-18T23:23:59.823+0000 I STORAGE [initandlisten] Finished shutting down session sweeper thread
2020-05-18T23:23:59.901+0000 I STORAGE [initandlisten] Downgrading WiredTiger datafiles.
2020-05-18T23:24:00.088+0000 I STORAGE [initandlisten] WiredTiger message [1589844240:88483][1526:0x7fa98a9fca40], txn-recover: Main recovery loop: starting at 47/2176 to 48/256
2020-05-18T23:24:00.190+0000 I STORAGE [initandlisten] WiredTiger message [1589844240:190325][1526:0x7fa98a9fca40], txn-recover: Recovering log 47 through 48
2020-05-18T23:24:00.250+0000 I STORAGE [initandlisten] WiredTiger message [1589844240:250635][1526:0x7fa98a9fca40], txn-recover: Recovering log 48 through 48
2020-05-18T23:24:00.302+0000 I STORAGE [initandlisten] WiredTiger message [1589844240:302709][1526:0x7fa98a9fca40], txn-recover: Set global recovery timestamp: 0
2020-05-18T23:24:00.477+0000 I STORAGE [initandlisten] shutdown: removing fs lock...
2020-05-18T23:24:00.477+0000 I CONTROL [initandlisten] now exiting
2020-05-18T23:24:00.477+0000 I CONTROL [initandlisten] shutting down with code:62
I did also run with the --repair flag: it said it repaied the sensorTag collection, but no, it didn't, and still failed:
020-05-19T00:09:27.800+0000 I STORAGE [initandlisten] Repairing collection StagServExpress.sensortags
2020-05-19T00:09:27.801+0000 I STORAGE [initandlisten] Verify succeeded on uri table:collection-22-4256855214379632921. Not salvaging.
2020-05-19T00:09:27.805+0000 I INDEX [initandlisten] build index on: StagServExpress.sensortags properties: { v: 2, key: { _id: 1 }, name: "_id_", ns: "StagServExpress.sensortags" }
2020-05-19T00:09:27.806+0000 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 166 megabytes of RAM
2020-05-19T00:09:27.810+0000 I INDEX [initandlisten] build index on: StagServExpress.sensortags properties: { v: 2, unique: true, key: { UUID: 1 }, name: "UUID_1", ns: "StagServExpress.sensortags", background: true }
2020-05-19T00:09:27.810+0000 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 166 megabytes of RAM
2020-05-19T00:09:27.813+0000 I INDEX [initandlisten] build index on: StagServExpress.sensortags properties: { v: 2, key: { nickname: 1 }, name: "nickname_1", ns: "StagServExpress.sensortags", background: true }
2020-05-19T00:09:27.813+0000 I INDEX [initandlisten] building index using bulk method; build may temporarily use up to 166 megabytes of RAM
MongoDB 4.0.18 was released a month ago (April 13). You said:
Mongod has been running as v4 for several months.
Which version were you running for "several months" and how long have you been running 4.0.18 for?
Did you upgrade MongoDB at the same time as you experienced the crash?
Do you have backups?
Assuming you have a backup, reinstate the version of MongoDB that was in use prior to the crash and run it on the data directory as close to the crash as your backups allow.
The error message you are seeing was added in 4.0.13, so if you run 4.0.12 or earlier you shouldn't get this error (but I don't know if your data is corrupted and what other issues might exist).
Functionality does get backported to older versions, so it's possible there are older 4.0 servers that don't have the UUID that the current 4.0 is expecting because the changes were made in 4.0 (or 4.2) and backported to 3.6 but after 4.0.0 came out.
yesterday when i was about to install mongodb, i created /data/db with the right permission and i typed mongod but it got stuck on [ftdc] Marking collection local.oplog.rs as collection version: since 1 hour, thanks if you take time to help me
I was having the same problem. Open a new terminal, cd into the same path and then run "mongo" command. Then it worked!
I think we have had the same problem and I found the solution for myself.
But I beg my pardon if I am wrong)
If you want to get access to Mongodb you have to type mongo instead of mongod.
I was doing a step by step tutorial on installation of MongoDB on Centos 7 and playing around with it.
At some point I've decided to shutdown the server with:
db.shutdownServer()
And after that I've had trouble starting/logging into the database with mongod.
But the thing is, that mongod starts the Mongodb server in your current terminal.
[root#ip-*-*-*-* tmp]# mongod
2020-06-09T19:52:14.630+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-06-09T19:52:14.632+0000 W ASIO [main] No TransportLayer configured during NetworkInterface startup
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] MongoDB starting : pid=27618 port=27017 dbpath=/data/db 64-bit host=ip-*-*-*-*.eu-central-1.compute.internal
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] db version v4.2.7
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] git version: 51d9fe12b5d19720e72dcd7db0f2f17dd9a19212
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] modules: none
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] build environment:
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] distmod: rhel70
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] distarch: x86_64
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-06-09T19:52:14.632+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2020-06-09T19:52:14.633+0000 I STORAGE [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2020-06-09T19:52:14.633+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=256M,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,close_scan_interval=10,close_handle_minimum=250),statistics_log=(wait=0),verbose=[recovery_progress,checkpoint_progress],
2020-06-09T19:52:15.356+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:356822][27618:0x7f9b34a81c40], txn-recover: Recovering log 6 through 7
2020-06-09T19:52:15.412+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:412272][27618:0x7f9b34a81c40], txn-recover: Recovering log 7 through 7
2020-06-09T19:52:15.500+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:500634][27618:0x7f9b34a81c40], txn-recover: Main recovery loop: starting at 6/22528 to 7/256
2020-06-09T19:52:15.609+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:609015][27618:0x7f9b34a81c40], txn-recover: Recovering log 6 through 7
2020-06-09T19:52:15.672+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:672877][27618:0x7f9b34a81c40], txn-recover: Recovering log 7 through 7
2020-06-09T19:52:15.727+0000 I STORAGE [initandlisten] WiredTiger message [1591732335:727038][27618:0x7f9b34a81c40], txn-recover: Set global recovery timestamp: (0, 0)
2020-06-09T19:52:15.735+0000 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2020-06-09T19:52:15.739+0000 I STORAGE [initandlisten] Timestamp monitor starting
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2020-06-09T19:52:15.741+0000 I CONTROL [initandlisten]
2020-06-09T19:52:15.743+0000 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2020-06-09T19:52:15.744+0000 I STORAGE [initandlisten] Flow Control is enabled on this deployment.
2020-06-09T19:52:15.744+0000 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
2020-06-09T19:52:15.745+0000 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
2020-06-09T19:52:15.746+0000 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
2020-06-09T19:52:15.746+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2020-06-09T19:52:15.748+0000 I SHARDING [LogicalSessionCacheRefresh] Marking collection config.system.sessions as collection version: <unsharded>
2020-06-09T19:52:15.749+0000 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>
2020-06-09T19:52:15.749+0000 I NETWORK [listener] Listening on /tmp/mongodb-27017.sock
2020-06-09T19:52:15.749+0000 I NETWORK [listener] Listening on 127.0.0.1
2020-06-09T19:52:15.749+0000 I NETWORK [listener] waiting for connections on port 27017
2020-06-09T19:52:16.000+0000 I SHARDING [ftdc] Marking collection local.oplog.rs as collection version: <unsharded>
And I just got stuck at this point and pressed ctrl+C
2020-06-09T19:56:26.172+0000 I CONTROL [signalProcessingThread] got signal 2 (Interrupt), will terminate after current cmd ends
2020-06-09T19:56:26.172+0000 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2020-06-09T19:56:26.176+0000 I NETWORK [listener] removing socket file: /tmp/mongodb-27017.sock
2020-06-09T19:56:26.176+0000 I - [signalProcessingThread] Stopping further Flow Control ticket acquisitions.
2020-06-09T19:56:26.176+0000 I CONTROL [signalProcessingThread] Shutting down free monitoring
2020-06-09T19:56:26.176+0000 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] Deregistering all the collections
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] Timestamp monitor shutting down
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] Shutting down session sweeper thread
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] Finished shutting down session sweeper thread
2020-06-09T19:56:26.180+0000 I STORAGE [signalProcessingThread] Shutting down journal flusher thread
2020-06-09T19:56:26.264+0000 I STORAGE [signalProcessingThread] Finished shutting down journal flusher thread
2020-06-09T19:56:26.264+0000 I STORAGE [signalProcessingThread] Shutting down checkpoint thread
2020-06-09T19:56:26.264+0000 I STORAGE [signalProcessingThread] Finished shutting down checkpoint thread
2020-06-09T19:56:26.268+0000 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2020-06-09T19:56:26.268+0000 I CONTROL [signalProcessingThread] now exiting
2020-06-09T19:56:26.268+0000 I CONTROL [signalProcessingThread] shutting down with code:0
And at this point I realized that I had that fatal extra letter and I was able to access the database with
[root#ip-*-*-*-* tmp]# mongo
After many hours and few reinstalls, I decided to look and view if some files was "corrupt", I found that MongoDB doesn't delete its folder in /var/lib/, so I deleted it and when I reinstalled MongoDB again it worked like a charm.
root#ip-172-31-34-204:/tmp/asterisk-16.1.1# sudo mongod --repair
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] MongoDB starting : pid=1980 port=27017 dbpath=/data/db 64-bit host=ip-172-31-34-204
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] db version v3.4.13
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] git version: fbdef2ccc53e0fcc9afb570063633d992b2aae42
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] allocator: tcmalloc
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] modules: none
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] build environment:
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] distmod: ubuntu1604
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] distarch: x86_64
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-02-11T10:55:19.993+0000 I CONTROL [initandlisten] options: { repair: true }
2020-02-11T10:55:19.997+0000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2020-02-11T10:55:19.997+0000 I STORAGE [initandlisten] Detected WT journal files. Running recovery from last checkpoint.
2020-02-11T10:55:19.997+0000 I STORAGE [initandlisten] journal to nojournal transition config: create,cache_size=1459M,session_max=20000,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),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),verbose=(recovery_progress),
2020-02-11T10:55:20.015+0000 E STORAGE [initandlisten] WiredTiger error (-31802) [1581418520:15471][1980:0x7fac126bad00], txn-recover: unsupported WiredTiger file version: this build only supports major/minor versions up to 1/0, and the file is version 2/0: WT_ERROR: non-specific WiredTiger error
2020-02-11T10:55:20.015+0000 E STORAGE [initandlisten] WiredTiger error (0) [1581418520:15533][1980:0x7fac126bad00], txn-recover: WiredTiger is unable to read the recovery log.
2020-02-11T10:55:20.015+0000 E STORAGE [initandlisten] WiredTiger error (0) [1581418520:15552][1980:0x7fac126bad00], txn-recover: This may be due to the log files being encrypted, being from an older version or due to corruption on disk
2020-02-11T10:55:20.015+0000 E STORAGE [initandlisten] WiredTiger error (0) [1581418520:15562][1980:0x7fac126bad00], txn-recover: You should confirm that you have opened the database with the correct options including all encryption and compression options
2020-02-11T10:55:20.015+0000 E STORAGE [initandlisten] WiredTiger error (-31802) [1581418520:15632][1980:0x7fac126bad00], txn-recover: Recovery failed: WT_ERROR: non-specific WiredTiger error
2020-02-11T10:55:20.018+0000 I - [initandlisten] Assertion: 28718:-31802: WT_ERROR: non-specific WiredTiger error src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 254
2020-02-11T10:55:20.018+0000 I STORAGE [initandlisten] exception in initAndListen: 28718 -31802: WT_ERROR: non-specific WiredTiger error, terminating
2020-02-11T10:55:20.018+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2020-02-11T10:55:20.018+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2020-02-11T10:55:20.018+0000 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2020-02-11T10:55:20.018+0000 I CONTROL [initandlisten] now exiting
2020-02-11T10:55:20.018+0000 I CONTROL [initandlisten] shutting down with code:100
Before this I've tried giving the account authentication: How to secure MongoDB with username and password
Can not connect to mongo also:
root#ip-172-31-34-204:/tmp/asterisk-16.1.1# mongo
MongoDB shell version v3.4.13
connecting to: mongodb://127.0.0.1:27017
2020-02-11T10:56:37.487+0000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-02-11T10:56:37.487+0000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect#src/mongo/shell/mongo.js:240:13
#(connect):1:6
exception: connect failed
I`ve started mongoDB and it seems like its running fine, I think (see message below)? Then I open a new terminal window and I try to use the "mongo" command I get the following message:
-bash: mongo: command not found
When I try commands such as "use newtest", it says
-bash: use: command not found
My Path:
PATH=/Users/myname/.npm-global/bin:$PATH
Here is the message when I start mongoDB:
myname-MacBook-Air:~ myname$ mongod
I CONTROL [initandlisten] MongoDB starting : pid=581 port=27017 dbpath=/data/db 64-bit host=myname-MacBook-Air.local
I CONTROL [initandlisten] db version v3.6.2
I CONTROL [initandlisten] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
I CONTROL [initandlisten] OpenSSL version: OpenSSL 0.9.8zh 14 Jan 2016
I CONTROL [initandlisten] allocator: system
I CONTROL [initandlisten] modules: none
I CONTROL [initandlisten] build environment:
I CONTROL [initandlisten] distarch: x86_64
I CONTROL [initandlisten] target_arch: x86_64
I CONTROL [initandlisten] options: {}
W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
W STORAGE [initandlisten] Recovering data from the last clean checkpoint.
I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=3584M,session_max=20000,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),
I STORAGE [initandlisten] WiredTiger message [1519475976:405758][581:0x7fff95b02340], txn-recover: Main recovery loop: starting at 4/3200
I STORAGE [initandlisten] WiredTiger message [1519475976:408878][581:0x7fff95b02340], txn-recover: Recovering log 4 through 5
I STORAGE [initandlisten] WiredTiger message [1519475976:564148][581:0x7fff95b02340], txn-recover: Recovering log 5 through 5
I CONTROL [initandlisten]
I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
I CONTROL [initandlisten]
I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
I CONTROL [initandlisten]
I CONTROL [initandlisten]
I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
I NETWORK [initandlisten] waiting for connections on port 27017
I FTDC [ftdc] Unclean full-time diagnostic data capture shutdown detected, found interim file, some metrics may have been lost. OK
What am I doing wrong here to start mongodB? Or am I misunderstanding it?
Thanks :)