开发者

Why do I get application errors when I stop and restart my mongod service

If I cancel and restart my mongodb on the default port, I reconnect fine and there aren't any problems.

When I do so on my 27018 port, it seems to reconnect in my bash window and I get this statement at the end of the restart:

initandlisten] waiting for connections on port 27018
websvr] web admin interface listening on port 28018

but when I r开发者_运维技巧un my app I get errors like

Operation failed with the following exception: connection closed

and

Operation failed with the following exception: Broken pipe - send(2)
:10:in `synchronize'


Mongoid creates a connection to the MongoDB process and then keeps this around for performance reasons. If the server goes down the connection is broken at the server end and the client can no longer send requests.

In your Mongoid configuration you can configure the connection to be retriable, so that failed connections will be retried in the even of failure.

max_retries_on_connection_failure [2]

The number in square brackets is the number of times to retry (with half second gap between each try) before raising an exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜