前提・実現したいこと
さくらのVPSのUbuntu 20.04で、MongoDBを起動しようとしています。
ディレクトリ権限に関するエラーが発生したので、権限の設定を行ったのですが、エラーが変わらない状況です。
ご教授いただけると助かります。
発生している問題・エラーメッセージ
MongoDBの起動コマンド(sudo systemctl start mongod
)を入力すると、ディレクトリ権限関連のエラーが発生しました。
● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2021-05-16 03:08:26 JST; 1min 12s ago Docs: https://docs.mongodb.org/manual Process: 143473 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100) Main PID: 143473 (code=exited, status=100)
var/log/mongodb/mongod.log
エラー全文から抜粋。
2021-05-16T18:20:35.002+0900 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/mongodb, terminating
エラー全文
2021-05-16T18:20:34.975+0900 I CONTROL [main] ***** SERVER RESTARTED ***** 2021-05-16T18:20:34.976+0900 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none' 2021-05-16T18:20:35.001+0900 W ASIO [main] No TransportLayer configured during NetworkInterface startup 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] MongoDB starting : pid=148310 port=27017 dbpath=/var/lib/mongodb 64-bit host=ik1-408-36284 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] db version v4.2.14 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] git version: 0e6db36e92d82cc81cbd40ffd607eae88dc1f09d 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] allocator: tcmalloc 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] modules: none 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] build environment: 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] distmod: ubuntu1804 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] distarch: x86_64 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] target_arch: x86_64 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "0.0.0.0", 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" } } 2021-05-16T18:20:35.002+0900 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /var/lib/mongodb, terminating 2021-05-16T18:20:35.002+0900 I REPL [initandlisten] Stepping down the ReplicationCoordinator for shutdown, waitTime: 10000ms 2021-05-16T18:20:35.002+0900 I SHARDING [initandlisten] Shutting down the WaitForMajorityService 2021-05-16T18:20:35.002+0900 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2021-05-16T18:20:35.002+0900 I NETWORK [initandlisten] Shutting down the global connection pool 2021-05-16T18:20:35.002+0900 I STORAGE [initandlisten] Shutting down the FlowControlTicketholder 2021-05-16T18:20:35.002+0900 I - [initandlisten] Stopping further Flow Control ticket acquisitions. 2021-05-16T18:20:35.002+0900 I INDEX [initandlisten] Shutting down the IndexBuildsCoordinator 2021-05-16T18:20:35.002+0900 I NETWORK [initandlisten] Shutting down the ReplicaSetMonitor 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] Shutting down free monitoring 2021-05-16T18:20:35.002+0900 I FTDC [initandlisten] Shutting down full-time data capture 2021-05-16T18:20:35.002+0900 I STORAGE [initandlisten] Shutting down the HealthLog 2021-05-16T18:20:35.002+0900 I - [initandlisten] Dropping the scope cache for shutdown 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] now exiting 2021-05-16T18:20:35.002+0900 I CONTROL [initandlisten] shutting down with code:100
試したこと
権限を付与する2つの方法を試しました。
- ディレクトリの権限をchmodコマンドで許可
var/lib/mongodb
それぞれのディレクトリを777に変更しました。
- mongodbユーザーにroot権限を付与
visudoコマンドで、以下のようにmongodbユーザーにroot権限を付与しました。
root ALL=(ALL:ALL) ALL ubuntu ALL=(ALL:ALL) ALL mongodb ALL=(ALL:ALL) ALL
補足情報(FW/ツールのバージョンなど)
- MongoDB v4.2.14
- Ubuntu 20.04
- MongoDB関連のインストール済みパッケージ
mongodb-org-mongos/bionic,now 4.2.14 amd64 [installed,upgradable to: 4.4.6]
mongodb-org-server/bionic,now 4.2.14 amd64 [installed,upgradable to: 4.4.6]
mongodb-org-shell/bionic,now 4.2.14 amd64 [installed,upgradable to: 4.4.6]
mongodb-org-tools/bionic,now 4.2.14 amd64 [installed,upgradable to: 4.4.6]
mongodb-org/focal,now 4.4.6 amd64 [installed]
回答1件
あなたの回答
tips
プレビュー