0

昨天当我要安装 mongodb 时,我创建了 /data/db 并使用了正确的权限,我输入了 mongod 但它卡在 [ftdc] Marking collection local.oplog.rs as collection version: 从 1 小时开始,谢谢你是时候帮助我了

4

3 回答 3

0

我遇到了同样的问题。打开一个新终端,cd 进入相同的路径,然后运行“mongo”命令。然后它起作用了!

于 2020-07-24T21:43:26.347 回答
0

我认为我们遇到了同样的问题,我为自己找到了解决方案。但如果我错了,请原谅)

如果你想访问 Mongodb,你必须输入 mongo 而不是 mongod。

我正在逐步教程在 Centos 7 上安装 MongoDB 并使用它。在某些时候,我决定关闭服务器:

db.shutdownServer()

之后,我在使用 mongod 启动/登录数据库时遇到了麻烦。但问题是,mongod 在您当前的终端中启动了 Mongodb 服务器。

[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>

我只是在这一点上卡住并按下 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

在这一点上,我意识到我有那个致命的额外字母,我能够访问数据库

[root@ip-*-*-*-* tmp]# mongo
于 2020-06-09T21:26:55.470 回答
0

经过几个小时和几次重新安装后,我决定查看并查看某些文件是否“损坏”,我发现 MongoDB 没有删除 /var/lib/ 中的文件夹,所以我删除了它,当我再次重新安装 MongoDB 时它工作像一个魅力。

于 2020-03-12T17:29:13.440 回答