0
我們已經創建了鏡像數據庫,它是我們應用程序主數據庫的副本。目標是在不可用的情況下在兩個數據庫之間跳轉。Laravel 4 - 鏡像數據庫?
我在想如何在Laravel 4中實現這樣的事情?可以說我有
'mysql' => array(
'driver' => 'mysql',
'host' => '172.22.22.22',
'port' => '3306',
'database' => 'db',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
和
'mysql' => array(
'driver' => 'mysql',
'host' => '172.22.22.23',
'port' => '3306',
'database' => 'db',
'username' => 'username',
'password' => 'password',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
根本不同的主機,但相同的憑據。如何配置這些數據庫之間的切換,以防其中一個數據庫不可用?任何來源或文檔將不勝感激。
對我來說,似乎最好的選擇是讓負載均衡器執行故障轉移選擇的骯髒工作。 – Repox