开发者

What is a way to handle database connection failure in Django 1.2?

What is开发者_如何学Python a way to handle database unavailability and redirect queries from unavailable slave to another one in Django 1.2?

Btw, i found out, that it was discussed: http://code.djangoproject.com/wiki/MultipleDatabaseSupport#Requirements (see "Transparently handling database failure")

UPD> I use PostgreSQL backend (probably will use pg pool or some other potgres cluster) under linux


If you are using a PostgreSQL backend and are on a Linux/BSD etc. system, consider using pgpool: http://www.pgpool.net/ This utility handles the connections to the DB server for you, so you only connect to pgpool. No need for you to implement any more logic. Just connect to pgpool, not to PostgreSQL itself.


Unfortunately, at the moment there's no way to use the DATABASE_ROUTERS feature in order to handle an unavailable database, you'll have to use an external tool as others have suggested.


There's also a proxy for MySQL, MySQL Proxy. You would connect to the proxy, and that proxy would know how to handle failover. In the case of MySQL Proxy, it is designed for failover, so I expect it to be both stable and knowing how to handle failures:)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜