1

所以我昨晚忘记重新插上我的笔记本电脑,我的笔记本电脑断电,导致我的微型实例没有很好的关机。现在,当我启动微实例时,控制台中的一切看起来都正常,但我无法连接到 monogodb 实例。我认为这可能是因为 mongod.lock 文件被闲置了,所以我去找它并从这里删除它:

/var/vcap/store/mongodb/a925311a-2145-4a50-b103-e243da010e7c/data/mongod.lock

然后我不知道如何重新启动服务(有人知道吗??),所以我只是重新启动了虚拟机。我仍然无法连接。在我移除锁并尝试隧道之前,我会收到此错误:

vmc tunnel mongo-xxx
1: none
2: mongorestore
3: mongo
4: mongodump
Which client would you like to start?> 3

Opening tunnel on port 10000... OK
Waiting for local tunnel to become available... OK
MongoDB shell version: 2.2.2
connecting to: localhost:10000/db
Tue Jan 29 09:11:49 DBClientCursor::init call() failed
Tue Jan 29 09:11:49 Error: Error during mongo startup. :: caused by :: 10276 DBClientBase::findN: transport error: localhost:10000 ns: admin.$cmd query: { whatsmyuri: 1 } src/mongo/shell/mongo.js:93
exception: connect failed
'mongo' execution failed; is it in your $PATH?

现在重新启动后,我收到此错误:

vmc tunnel mongo-xxx
1: none
2: mongorestore
3: mongo
4: mongodump
Which client would you like to start?> 3

Opening tunnel on port 10000... FAILED
CFoundry::ServiceGatewayError: 503: Unexpected response from service gateway
For more information, see ~/.vmc/crash

关闭错误后修复微实例的正确步骤是什么?

谢谢

编辑:我在 mongodb 日志中发现了另一个错误:

Tue Jan 29 16:28:43 [initandlisten] options: { auth: "true", bind_ip: "0.0.0.0", config: "/var/vcap/store/mongodb/a925311a-2145-4a50-b103-e243da010e7c/mongodb.conf", dbpath: "/var/vcap/store/mongodb/a925311a-2145-4a50-b103-e243da010e7c/data", logpath: "/var/vcap/sys/service-log/mongodb/a925311a-2145-4a50-b103-e243da010e7c/mongodb.log", maxConns: 500, nohttpinterface: "true", nojournal: true, noprealloc: "true", port: 25001, quota: "true", quotaFiles: 4, smallfiles: "true" }
**************
Error: journal files are present in journal directory, yet starting without --journal enabled.
It is recommended that you start with journaling enabled so that recovery may occur.
**************

但是查看 monogodb.conf 文件说:

# journaling is currently preallocating 4G of space on disk
# we can't do that.
#
#journal    = true

所以我不确定这会奏效。我开始认为我只需要删除服务并重新创建它,但这似乎是一个糟糕的解决方案......

4

1 回答 1

2

我现在开始工作了。我相信这是一个组合:

1)在以下位置删除 mongod.lock 文件:/var/vcap/store/mongodb/a925311a-2145-4a50-b103-e243da010e7c/data/mongod.lock

2)编辑 /var/vcap/jobs/mongodb_node/config/mongodb_node.yml 并将 mongo_options 更改为:

mongod_options:
  "1.8": ""
  "2.0": "--nojournal"

mongod_options:
  "1.8": ""
  "2.0": "--journal"

我还发现,如果我终止了该mongodb_node进程,它会重新启动它自己,然后 mongod 开始运行。

于 2013-01-29T21:38:24.960 回答