停电后的微云灾害问题

时间:2013-01-29 16:43:29

标签: mongodb cloudfoundry

所以我忘了昨晚把我的笔记本电脑插回来了,我的笔记本电脑失去了电力,杀了我的微型实例而没有很好的关机。现在,当我启动微实例时,控制台中的所有内容看起来都不错,但我无法连接到monogodb实例。我以为这可能是因为mongod.lock文件被遗弃了,所以我去找那个并从这里删除它:

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

然后我无法弄清楚如何重启服务(任何人都知道??),所以我只是重新启动了VM。我仍然无法获得连接。在我移除锁并尝试隧道之前,我会收到此错误:

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

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

1 个答案:

答案 0 :(得分:2)

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

1)删除位于/var/vcap/store/mongodb/a925311a-2145-4a50-b103-e243da010e7c/data/mongod.lock

的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开始运行。