【发布时间】:2021-07-20 02:14:22
【问题描述】:
我刚刚启动了一个新的 AWS Linux AMI 2016.09.1(HVM) 并下载了最新的 Mongodb 版本。我正在使用 MongoDB 版本 3.0.14。我将 /etc/mongod.conf 更新为以下内容,
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: true
path: /var/log/mongodb/mongod.log
# Where and how to store data.
storage:
dbPath: /var/lib/mongo
journal:
enabled: true
# engine:
# mmapv1:
# wiredTiger:
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongodb/mongod.pid # location of pidfile
# network interfaces
net:
port: 27017
# bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on
all interfaces.
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options
#auditLog:
#snmp:
我第一次使用服务运行Mongodb,
sudo service mongod start
一切正常。当我停止 Mongodb 并重新启动时,
sudo service mongod stop
sudo service mongod restart
我收到以下错误,
Error starting mongod. /var/run/mongodb/mongod.pid exists.
这是日志文件 /var/log/mongodb/mongod.log 中的内容,
2017-01-16T14:11:16.869+0000 I CONTROL ***** SERVER RESTARTED *****
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] MongoDB starting :
pid=2820 port=27017 dbpath=/var/lib/mongo 64-bit hos
t=ip-10-0-0-91
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] db version v3.0.14
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] git version:
08352afcca24bfc145240a0fac9d28b978ab77f3
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] build info: Linux
ip-10-63-190-181 3.4.43-43.43.amzn1.x86_64 #1 SMP Mon
May 6 18:04:41 UTC 2013 x86_64 BOOST_LIB_VERSION=1_49
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] allocator: tcmalloc
2017-01-16T14:11:16.872+0000 I CONTROL [initandlisten] options: { config:
"/etc/mongod.conf", net: { port: 27017 }, processMan
agement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" },
storage: { dbPath: "/var/lib/mongo", journal: { enabled: t
rue } }, systemLog: { destination: "file", logAppend: true, path:
"/var/log/mongodb/mongod.log" } }
2017-01-16T14:11:16.893+0000 E NETWORK [initandlisten] Failed to unlink
socket file /tmp/mongodb-27017.sock errno:1 Operation
not permitted
2017-01-16T14:11:16.893+0000 I - [initandlisten] Fatal Assertion
28578
2017-01-16T14:11:16.893+0000 I - [initandlisten]
***aborting after fassert() failure
我已经看到几个博客发布了关于这个问题的解决方案,但它们似乎都不起作用。周日花了一整天试图弄清楚这一点。在运行早期的 AWS 实例和 Mongo 之前从未遇到过这个问题。
【问题讨论】:
-
尝试 'sudo rm /var/run/mongodb/mongod.pid' 然后重新启动服务
-
你好戴夫,是的,这是我做的第一件事。那没起效。该文件仅包含一行“2943”。我猜这是某些 MongoDB 进程的 PID。
-
得到同样的错误,这是因为本地存储空间已满,运行
df -h看到,从EBS(本地存储)中删除了几个文件,然后运行正常。/dev/xvda1 7.8G 7.7G 0M 100%
标签: mongodb amazon-web-services