前提・実現したいこと
mongodbを起動したいです。
過去に起動できていたのですが、おそらく当時強制終了したせいか
それから再び起動しようとしたら失敗しました。
発生している問題・エラーメッセージ
$ sudo service mongod start mongod: unrecognized service
$ mongod 2020-09-17T03:18:02.257+0900 I CONTROL [initandlisten] MongoDB starting : pid=1117 port=27017 dbpath=/data/db 64-bit host=LAPTOP-LSE3HD1V 2020-09-17T03:18:02.262+0900 I CONTROL [initandlisten] db version v3.4.24 2020-09-17T03:18:02.263+0900 I CONTROL [initandlisten] git version: 865b4f6a96d0f5425e39a18337105f33e8db504d 2020-09-17T03:18:02.271+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017 2020-09-17T03:18:02.273+0900 I CONTROL [initandlisten] allocator: tcmalloc 2020-09-17T03:18:02.279+0900 I CONTROL [initandlisten] modules: none 2020-09-17T03:18:02.281+0900 I CONTROL [initandlisten] build environment: 2020-09-17T03:18:02.287+0900 I CONTROL [initandlisten] distmod: ubuntu1604 2020-09-17T03:18:02.293+0900 I CONTROL [initandlisten] distarch: x86_64 2020-09-17T03:18:02.300+0900 I CONTROL [initandlisten] target_arch: x86_64 2020-09-17T03:18:02.302+0900 I CONTROL [initandlisten] options: {} 2020-09-17T03:18:02.309+0900 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2020-09-17T03:18:02.309+0900 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2020-09-17T03:18:02.322+0900 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2020-09-17T03:18:02.323+0900 I CONTROL [initandlisten] now exiting 2020-09-17T03:18:02.334+0900 I CONTROL [initandlisten] shutting down with code:100
試したこと
mongoDBのインストール方法はこのページを参照しました。
https://qiita.com/segavvy/items/8f93187ec89f4831d863
上記のようなエラーが出たので、以下のページを参照しました。
https://qiita.com/hahirusan/items/278b1f5435c0d127ab02
すると
$ sudo mongod --repair 2020-09-17T03:23:56.689+0900 I CONTROL [initandlisten] MongoDB starting : pid=1121 port=27017 dbpath=/data/db 64-bit host=LAPTOP-LSE3HD1V 2020-09-17T03:23:56.695+0900 I CONTROL [initandlisten] db version v3.4.24 2020-09-17T03:23:56.696+0900 I CONTROL [initandlisten] git version: 865b4f6a96d0f5425e39a18337105f33e8db504d 2020-09-17T03:23:56.703+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017 2020-09-17T03:23:56.704+0900 I CONTROL [initandlisten] allocator: tcmalloc 2020-09-17T03:23:56.705+0900 I CONTROL [initandlisten] modules: none 2020-09-17T03:23:56.711+0900 I CONTROL [initandlisten] build environment: 2020-09-17T03:23:56.716+0900 I CONTROL [initandlisten] distmod: ubuntu1604 2020-09-17T03:23:56.717+0900 I CONTROL [initandlisten] distarch: x86_64 2020-09-17T03:23:56.719+0900 I CONTROL [initandlisten] target_arch: x86_64 2020-09-17T03:23:56.720+0900 I CONTROL [initandlisten] options: { repair: true } 2020-09-17T03:23:56.722+0900 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating 2020-09-17T03:23:56.722+0900 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2020-09-17T03:23:56.729+0900 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2020-09-17T03:23:56.736+0900 I CONTROL [initandlisten] now exiting 2020-09-17T03:23:56.737+0900 I CONTROL [initandlisten] shutting down with code:100
エラー内容が、変わらない、、、
$ mongod -dbpath /usr/local/var/mongodb 2020-09-17T03:25:13.035+0900 I CONTROL [initandlisten] MongoDB starting : pid=1124 port=27017 dbpath=/usr/local/var/mongodb 64-bit host=LAPTOP-LSE3HD1V 2020-09-17T03:25:13.041+0900 I CONTROL [initandlisten] db version v3.4.24 2020-09-17T03:25:13.049+0900 I CONTROL [initandlisten] git version: 865b4f6a96d0f5425e39a18337105f33e8db504d 2020-09-17T03:25:13.054+0900 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2n 7 Dec 2017 2020-09-17T03:25:13.055+0900 I CONTROL [initandlisten] allocator: tcmalloc 2020-09-17T03:25:13.062+0900 I CONTROL [initandlisten] modules: none 2020-09-17T03:25:13.063+0900 I CONTROL [initandlisten] build environment: 2020-09-17T03:25:13.070+0900 I CONTROL [initandlisten] distmod: ubuntu1604 2020-09-17T03:25:13.071+0900 I CONTROL [initandlisten] distarch: x86_64 2020-09-17T03:25:13.078+0900 I CONTROL [initandlisten] target_arch: x86_64 2020-09-17T03:25:13.079+0900 I CONTROL [initandlisten] options: { storage: { dbPath: "/usr/local/var/mongodb" } } 2020-09-17T03:25:13.086+0900 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /usr/local/var/mongodb not found., terminating 2020-09-17T03:25:13.093+0900 I NETWORK [initandlisten] shutdown: going to close listening sockets... 2020-09-17T03:25:13.094+0900 I NETWORK [initandlisten] shutdown: going to flush diaglog... 2020-09-17T03:25:13.099+0900 I CONTROL [initandlisten] now exiting 2020-09-17T03:25:13.101+0900 I CONTROL [initandlisten] shutting down with code:100
これでも起動できません。
どういう方針を取ればよいか教えていただけませんか?
よろしくお願いいたします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/09/17 04:38
2020/09/17 12:20
2020/09/18 10:55
2020/09/18 11:45