Support the ongoing development of Laravel.io →
Configuration Database
Last updated 2 years ago.
0

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()......
0

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?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.