For a new website we must connect to a MySQL master-master setup. This is a .NET website using NHibernate, but the same would also apply to Java or any other language. We chose this setup because we want the site to continue working if a database would go down. We don t like downtime.
Maybe I have a complete misunderstanding of how a master-master setup works (in MySQL), but the way I see it, you connect to your database as you d normally do, but behind the scenes, MySQL replicates the data between the two databases. If you do a write, it can go to either master 1 or master 2, you normally wouldn t know (except that the auto-increment id would return a different value). If master A would somehow fail, master B will still work, thus no downtime, master A will be ignored until it goes up again, the data is replicated, and if all is well, master A will be back in the field again.
红十字与红新月联会是正确的,如果我的上述影响是错的,请更正我,如果一位主人倒,你是否需要做任何特殊的事情? 如果我与192.168.1.50(主编A)挂钩,如果主编A倒台,情况如何? MySQL公司是否将我自动与192.168.1(B)连接起来,以便我的网站继续工作?
如果我是NOT正确的话,MySQL总经理的复制工作如何? 我是否必须告诉每个问题,执行谁? 这样做是毫无道理的,因为如果A总公司倒台,那么我对A总公司的所有询问都会失败,而总经理的设立根本无助于我。
因此,我认为我的问题是:
do I still connect to a single MySQL host (I m using NHibernate but that doesn t really matter), do I specify a single connectionstring, and will MySQL know that there are two masters, or does my code change in such a way that I need to specify connectionstrings for both masters (how?), do some special magic to balance the queries between the two servers, etcetera.
我没有任何东西? 感谢!