0
我有两个配置的数据库first_DB和second_DBDjango的与多个数据库
的配置似乎Django应用程序如下
DATABASES = {
'default': {
'ENGINE' : 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME' : 'emonitor', # Or path to database file if using sqlite3.
'USER' : 'emonitor', # Not used with sqlite3.
'PASSWORD': 'emonitor', # Not used with sqlite3.
'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
'PORT' : '', # Set to empty string for default. Not used with sqlite3.
},
'nagios': {
'ENGINE' : 'django.db.backends.mysql',
'NAME' : 'nagios',
'USER' : 'emonitor',
'PASSWORD': 'emonitor',
'HOST' : 'nagios.edc',
'PORT' : '',
},
}
Nagios的数据库是只读的,这是路由器模块中配置。
Nagios的数据库是一个远程机器
我的应用程序从Nagios的数据库获取数据并将其插入到我的本地数据库
如果Nagios的机器发生故障,或Nagios的机器上的MySQL是关闭的, Django的服务器,出现以下错误
enter code here_mysql_exceptions.OperationalError: (2005, "Unknown MySQL server host 'nagios.edc' (1)")
启动和应用程序不工作
我明白那是什么Dja保护非政府组织的服务器尝试连接到所有配置的数据库
,但我想我的应用程序工作,即使第二个数据库是不可达
我怎样才能做到这一点?
对不起,内德我编辑的问题更清楚 – Fanooos 2010-09-27 13:05:21