我的mongo数据库在运行使用mongo映像将数据登录到我的数据库的docker-compose后崩溃。这是运行
时出现的以下错误 sudo service mongod status
mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2019-07-19 15:03:15 EDT; 1s ago
Docs: https://docs.mongodb.org/manual
Process: 28755 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
Main PID: 28755 (code=exited, status=100)
Jul 19 15:03:15 ast systemd[1]: Started MongoDB Database Server.
Jul 19 15:03:15 ast systemd[1]: mongod.service: Main process exited, code=exited, status=100/n/a
Jul 19 15:03:15 ast systemd[1]: mongod.service: Unit entered failed state.
Jul 19 15:03:15 ast systemd[1]: mongod.service: Failed with result 'exit-code'.
这是我的mongod.log输出
2019-07-19T14:39:40.581-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-07-19T14:39:40.581-0400 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-07-19T14:39:40.581-0400 I CONTROL [initandlisten] now exiting
2019-07-19T14:39:40.581-0400 I CONTROL [initandlisten] shutting down with code:100
2019-07-19T15:03:15.165-0400 I CONTROL [main] ***** SERVER RESTARTED *****
2019-07-19T15:03:15.167-0400 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] MongoDB starting : pid=28755 port=27017 dbpath=/var/lib/mongodb 64-bit host=ast
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] db version v4.0.10
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] git version: c389e7f69f637f7a1ac3cc9fae843b635f20b766
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] allocator: tcmalloc
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] modules: none
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] build environment:
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] distmod: ubuntu1604
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] distarch: x86_64
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] target_arch: x86_64
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1", port: 27017 }, processManagement: { timeZoneInfo: "/usr/share/zoneinfo" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2019-07-19T15:03:15.177-0400 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/mongodb, terminating
2019-07-19T15:03:15.177-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-07-19T15:03:15.177-0400 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] now exiting
2019-07-19T15:03:15.177-0400 I CONTROL [initandlisten] shutting down with code:100
我尝试使用systemctl删除所有docker容器,然后重新启动。唯一有效的方法是卸载并重新安装mongodb。