I think you should use multi database connection
'read' => array(
'host'=>'...',
'driver'=>'...'
'port' => 3306,
'database' => '*****',
'username' => '***',
'password' => '****',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
),
'write' => array(
'host'=>'...',
'driver'=>'...'
'port' => 3306,
'database' => '*****',
'username' => '***',
'password' => '****',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => ''
),
Use for read
DB::connection('read')->table()......
And write
DB::connection('write')->table()......
Hello tuyenlaptrinh, thanks for your quick answer. But does this provide a fallback to the other database if one of them is down? For instance, if the read database is down, will it use the write database to do the reading?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community