在 Ubuntu 22.04 中安装 Mongodb-org 失败

在 Ubuntu 22.04 中安装 Mongodb-org 失败

在我的 ubuntu 22.04 上尝试安装 mongodb-org 几次,并按照许多 youtube 视频以及文档教程进行操作,但安装失败。

{"t":{"$date":"2022-10-14T23:57:58.874+05:30"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"} {"t":{"$date":"2022-10-14T23:57:58.879+05:30"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"main","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":"2022-10-14T23:57:58.879+05:30"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"} {"t":{"$date":"2022-10-14T23:57:58.879+05:30"},"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":"2022-10-14T23:57:58.882+05:30"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"} {"t":{"$date":"2022-10-14T23:57:58.882+05:30"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","ns":"config.tenantMigrationDonors"}} {"t":{"$date":"2022-10-14T23:57:58.882+05:30"},"s":"I", "c":"REPL", "id":5123008, "ctx":"main","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","ns":"config.tenantMigrationRecipients"}} {"t":{"$date":"2022-10-14T23:57:58.882+05:30"},"s":"I", "c":"CONTROL", "id":5945603, "ctx":"main","msg":"Multi threading initialized"} {"t":{"$date":"2022-10-14T23:57:58.883+05:30"},"s":"I", "c":"CONTROL", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":6365,"port":27017,"dbPath":"/data/db","architecture":"64-bit","host":"naeemgg"}}

运行mongod显示上述内容并检查状态显示

`mongod.service - MongoDB 数据库服务器已加载:已加载(/lib/systemd/system/mongod.service;已启用;供应商预设:已启用)活动:失败(结果:退出代码)自 2022-10-14 星期五 23:13:54 IST;53 分钟前文档:https://docs.mongodb.org/manual 进程:2037 ExecStart=/usr/bin/mongod --config /etc/mongod.conf(代码=exited,状态=14)主 PID:2037(代码=exited,状态=14)CPU:964ms

10 月 14 日 23:13:53 johns systemd[1]: 已启动 MongoDB 数据库服务器。10 月 14 日 23:13:54 johns systemd[1]: mongod.service: 主进程已退出,代码=已退出,状态=1> 10 月 14 日 23:13:54 johns systemd[1]: mongod.service: 失败,结果为“退出代码”。`

正在播放的mongo节目:

MongoDB shell version v5.0.13 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:372:17 @(connect):2:6 exception: connect failed exiting with code 1

答案1

使用 systemctl 而不是 service。安装后删除 sock 文件

sudo rm -rf /var/lib/mongodb-27017.sock

然后使用 systemctl 重新启动 mongodb,因为它在最新的 Ubuntu 版本甚至 Ubuntu 旧版本(如 20.04 LTS)中使用 SystemD

sudo systemctl 启动 mongod

使用服务运行导致错误

相关内容