質問編集履歴
2
試した結果を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -176,7 +176,89 @@
|
|
176
176
|
|
177
177
|
|
178
178
|
|
179
|
-
となるのではないかと推測し
|
179
|
+
となるのではないかと推測し調べてみたところ、以下のサイトを見つけました。
|
180
|
+
|
181
|
+
https://stackoverflow.com/questions/43589290/mongo-service-start-or-restart-always-fail/48122382
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
これの通りに、以下のように編集し、
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
```
|
190
|
+
|
191
|
+
// 編集後
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
# network interfaces
|
196
|
+
|
197
|
+
net:
|
198
|
+
|
199
|
+
port: 27017
|
200
|
+
|
201
|
+
bindIp: [127.0.0.1,0.0.0.0,::] # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
```
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
再度、再起動をかけてみましたが、結局できませんでした。
|
210
|
+
|
211
|
+
そして、以下のようにエラーが変わりました(status=2からstatus=14)。
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
```
|
216
|
+
|
217
|
+
[ec2-user@ip-hogehoge etc]$ sudo systemctl status mongod.service
|
218
|
+
|
219
|
+
● mongod.service - MongoDB Database Server
|
220
|
+
|
221
|
+
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
|
222
|
+
|
223
|
+
Active: failed (Result: exit-code) since 火 2020-06-16 07:16:53 UTC; 14s ago
|
224
|
+
|
225
|
+
Docs: https://docs.mongodb.org/manual
|
226
|
+
|
227
|
+
Process: 6894 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
|
228
|
+
|
229
|
+
Process: 6891 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
|
230
|
+
|
231
|
+
Process: 6888 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
|
232
|
+
|
233
|
+
Process: 6887 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
|
234
|
+
|
235
|
+
Main PID: 6559 (code=exited, status=0/SUCCESS)
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
6月 16 07:16:45 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: Starting MongoDB Database Server...
|
240
|
+
|
241
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal mongod[6894]: src/third_party/gperftools-2.7/dist/src/central_freelist.cc:...8192
|
242
|
+
|
243
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal mongod[6894]: 2020-06-16T07:16:53.696+0000 F - [main] out of memory.
|
244
|
+
|
245
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: mongod.service: control process exited, code=exited status=14
|
246
|
+
|
247
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: Failed to start MongoDB Database Server.
|
248
|
+
|
249
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: Unit mongod.service entered failed state.
|
250
|
+
|
251
|
+
6月 16 07:16:53 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: mongod.service failed.
|
252
|
+
|
253
|
+
Hint: Some lines were ellipsized, use -l to show in full.
|
254
|
+
|
255
|
+
```
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
現在も調査中ですが、解決方法が分かりません。
|
180
262
|
|
181
263
|
|
182
264
|
|
1
説明不足の部分を補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -6,6 +6,8 @@
|
|
6
6
|
|
7
7
|
|
8
8
|
|
9
|
+
そのために、/etc/mongod.confを編集して、localhost以外からのアクセスを許可したいです。
|
10
|
+
|
9
11
|
|
10
12
|
|
11
13
|
|
@@ -38,50 +40,196 @@
|
|
38
40
|
|
39
41
|
|
40
42
|
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
ローカルからEC2のMongoDBへのアクセスを許可するために、EC2にログインし、以下のように/etc/mongod.confを編集しました。
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```
|
52
|
+
|
53
|
+
// 編集前
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
# network interfaces
|
58
|
+
|
59
|
+
net:
|
60
|
+
|
61
|
+
port: 27017
|
62
|
+
|
63
|
+
bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
|
64
|
+
|
65
|
+
```
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
// 編集後
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
# network interfaces
|
78
|
+
|
79
|
+
net:
|
80
|
+
|
81
|
+
port: 27017
|
82
|
+
|
83
|
+
bindIp: 0.0.0.0,:: # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
その後、設定を反映させるためにrestartをしようとすると、以下のようなエラーが出て実行されません。
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
[ec2-user@ip-hogehoge etc]$ sudo service mongod restart
|
98
|
+
|
99
|
+
Redirecting to /bin/systemctl restart mongod.service
|
100
|
+
|
101
|
+
Job for mongod.service failed because the control process exited with error code. See "systemctl status mongod.service" and "journalctl -xe" for details.
|
102
|
+
|
103
|
+
```
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
言われた通りにstatusを実行してみると、以下のような結果が表示されます。
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```
|
112
|
+
|
113
|
+
[ec2-user@ip-hogehoge etc]$ sudo systemctl status mongod.service
|
114
|
+
|
115
|
+
● mongod.service - MongoDB Database Server
|
116
|
+
|
117
|
+
Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled)
|
118
|
+
|
119
|
+
Active: failed (Result: exit-code) since 火 2020-06-16 06:36:39 UTC; 14s ago
|
120
|
+
|
121
|
+
Docs: https://docs.mongodb.org/manual
|
122
|
+
|
123
|
+
Process: 6622 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=2)
|
124
|
+
|
125
|
+
Process: 6619 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS)
|
126
|
+
|
127
|
+
Process: 6616 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS)
|
128
|
+
|
129
|
+
Process: 6614 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS)
|
130
|
+
|
131
|
+
Main PID: 6559 (code=exited, status=0/SUCCESS)
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: Starting MongoDB Database Server...
|
136
|
+
|
137
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal mongod[6622]: Error parsing YAML config file: yaml-cpp: error at line 29, ...alue
|
138
|
+
|
139
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal mongod[6622]: try '/usr/bin/mongod --help' for more information
|
140
|
+
|
141
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: mongod.service: control process exited, code=exited status=2
|
142
|
+
|
143
|
+
6月 16 06:36:39 ip-hogehoge..ap-northeast-1.compute.internal systemd[1]: Failed to start MongoDB Database Server.
|
144
|
+
|
145
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: Unit mongod.service entered failed state.
|
146
|
+
|
147
|
+
6月 16 06:36:39 ip-hogehoge.ap-northeast-1.compute.internal systemd[1]: mongod.service failed.
|
148
|
+
|
149
|
+
Hint: Some lines were ellipsized, use -l to show in full.
|
150
|
+
|
151
|
+
```
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
この結果の上から5行目が、
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
Process: 6622 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=2)
|
162
|
+
|
163
|
+
```
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
となっており、これが原因で
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
```
|
172
|
+
|
173
|
+
6月 16 06:36:39 ip-hogehoge..ap-northeast-1.compute.internal systemd[1]: Failed to start MongoDB Database Server.
|
174
|
+
|
175
|
+
```
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
となるのではないかと推測しているのですが、調べても解決方法が見当たりません。
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
以上、ご教授いただけると助かります。
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
### 試したこと
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
/etc/mongod.conf を編集前に戻すと、問題なく再起動できます。
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
|
199
|
+
[ec2-user@ip-hogehoge etc]$ sudo service mongod restart
|
200
|
+
|
201
|
+
Redirecting to /bin/systemctl restart mongod.service
|
202
|
+
|
203
|
+
```
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
### 参考にしたサイト
|
210
|
+
|
211
|
+
|
212
|
+
|
41
213
|
https://stackoverflow.com/questions/49285525/connect-to-ec2-via-mongodb-compass-community
|
42
214
|
|
215
|
+
|
216
|
+
|
217
|
+
https://docs.mongodb.com/manual/reference/configuration-options/#net-options
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
https://teratail.com/questions/130790
|
222
|
+
|
223
|
+
|
224
|
+
|
43
|
-
|
225
|
+
https://docs.mongodb.com/manual/reference/exit-codes/
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
226
|
+
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
```
|
52
|
-
|
53
|
-
// 編集前
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
```
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
### 該当のソースコード
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
```ここに言語名を入力
|
68
|
-
|
69
|
-
|
227
|
+
↑ステータスコードについて
|
70
|
-
|
71
|
-
|
228
|
+
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
229
|
+
|
76
|
-
|
77
|
-
|
78
|
-
|
230
|
+
|
79
|
-
|
231
|
+
https://stackoverflow.com/questions/57380491/mongodb-status-failed-after-editing-mongo-conf-code-exited-status-2
|
80
|
-
|
81
|
-
|
82
|
-
|
232
|
+
|
233
|
+
|
234
|
+
|
83
|
-
|
235
|
+
https://superuser.com/questions/1397079/mongo-cant-start-service
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
ここにより詳細な情報を記載してください。
|