由于虚拟机服务器上需要安装Graylog需要安装MongoDB,尝试官网下载安装包,和yum安装均无法正常启动,折腾了好几天,重装了十几次,网上搜索了很多很多资料,均无法正常运行,百度上搜索各种文档,又是检查SeLinux,又是检查磁盘空间,又是检查文件夹权限,又是检查配置文件里的端口号占用,检查数据目录的权限,各种检查,折腾好几天也没搞定,一个mongodb好几天启动 不起来,崩溃了。。。几天在graylog官网,mongodb官网上瞎逛,偶尔翻到官网有说cpu问题,就尝试更改了虚拟机的cpu配置,没想到改完之后,直接启动,正常,疯了······这里记录下,太惨了,留做记录。

如图所示:将CPU模式改为SandyBridge

原始启动报错显示:

2023-12-21T09:58:15.375+0800 I RECOVERY [initandlisten] WiredTiger recoveryTimestamp. Ts: Timestamp(0, 0)
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten]
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten]
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten]
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten]
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2023-12-21T09:58:15.380+0800 I CONTROL  [initandlisten]
2023-12-21T09:58:15.382+0800 I SHARDING [initandlisten] Marking collection local.system.replset as collection version: <unsharded>
2023-12-21T09:58:15.384+0800 I SHARDING [initandlisten] Marking collection admin.system.roles as collection version: <unsharded>
2023-12-21T09:58:15.384+0800 I SHARDING [initandlisten] Marking collection admin.system.version as collection version: <unsharded>
2023-12-21T09:58:15.386+0800 I SHARDING [initandlisten] Marking collection local.startup_log as collection version: <unsharded>
2023-12-21T09:58:15.386+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/var/lib/mongodb/diagnostic.data'
2023-12-21T09:58:15.387+0800 I SHARDING [initandlisten] Marking collection config.system.sessions as collection version: <unsharded>
2023-12-21T09:58:15.389+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
2023-12-21T09:58:15.389+0800 I SHARDING [LogicalSessionCacheReap] Marking collection config.transactions as collection version: <unsharded>
2023-12-21T09:58:15.391+0800 I CONTROL  [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
2023-12-21T09:58:15.391+0800 I REPL     [signalProcessingThread] Stepping down the ReplicationCoordinator for shutdown, waitTime: 10000ms
2023-12-21T09:58:15.391+0800 I CONTROL  [signalProcessingThread] Shutting down the LogicalSessionCache
2023-12-21T09:58:15.391+0800 I NETWORK  [signalProcessingThread] shutdown: going to close listening sockets...
2023-12-21T09:58:15.392+0800 I NETWORK  [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2023-12-21T09:58:15.392+0800 I NETWORK  [signalProcessingThread] Shutting down the global connection pool
2023-12-21T09:58:15.392+0800 I STORAGE  [signalProcessingThread] Shutting down the PeriodicThreadToAbortExpiredTransactions
2023-12-21T09:58:15.392+0800 I REPL     [signalProcessingThread] Shutting down the ReplicationCoordinator
2023-12-21T09:58:15.392+0800 I SHARDING [signalProcessingThread] Shutting down the ShardingInitializationMongoD
2023-12-21T09:58:15.392+0800 I COMMAND  [signalProcessingThread] Killing all open transactions
2023-12-21T09:58:15.392+0800 I -        [signalProcessingThread] Killing all operations for shutdown
2023-12-21T09:58:15.392+0800 I NETWORK  [signalProcessingThread] Shutting down the ReplicaSetMonitor
2023-12-21T09:58:15.392+0800 I CONTROL  [signalProcessingThread] Shutting down free monitoring
2023-12-21T09:58:15.392+0800 I CONTROL  [signalProcessingThread] Shutting down free monitoring
2023-12-21T09:58:15.392+0800 I FTDC     [signalProcessingThread] Shutting down full-time data capture
2023-12-21T09:58:15.392+0800 I FTDC     [signalProcessingThread] Shutting down full-time diagnostic data capture
2023-12-21T09:58:15.392+0800 I STORAGE  [signalProcessingThread] Shutting down the HealthLog
2023-12-21T09:58:15.392+0800 I STORAGE  [signalProcessingThread] Shutting down the storage engine
2023-12-21T09:58:15.392+0800 I STORAGE  [signalProcessingThread] WiredTigerKVEngine shutting down
2023-12-21T09:58:15.393+0800 I STORAGE  [signalProcessingThread] Shutting down session sweeper thread
2023-12-21T09:58:15.393+0800 I STORAGE  [signalProcessingThread] Finished shutting down session sweeper thread
2023-12-21T09:58:15.496+0800 I STORAGE  [signalProcessingThread] shutdown: removing fs lock...
2023-12-21T09:58:15.496+0800 I -        [signalProcessingThread] Dropping the scope cache for shutdown
2023-12-21T09:58:15.496+0800 I CONTROL  [signalProcessingThread] now exiting
2023-12-21T09:58:15.496+0800 I CONTROL  [signalProcessingThread] shutting down with code:0

启动报错,日志上根本看不到任何问题,也显示不到具体报错,也通过chatgpt进行搜索,给出了如下的建议:

通过将cpu配置改为 SandyBridge重启服务器,重新启动mongodb,启动正常,

采坑好几天,疯了。。。再次崩溃!

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐