config\database.php.
Read/write Separation:
' MySQL ' =Array( ' Read ' =Array( ' Host ' = ' 192.168.1.1 ', ), ' Write ' =Array( ' Host ' = ' 196.168.1.2 ' ), ' Driver ' = ' MySQL ', ' Database ' = ' Database ', ' Username ' => ' root ' , ' password ' => ", ' charset ' => ' UTF8 ' , ' collation ' => Utf8_unicode_ci ' , ' prefix ' => ", ),
多读写分离:
‘mysql‘ => array( ‘read‘ => array( ‘host‘ => ‘192.168.1.1‘,
< Span class= "pun" >< Span class= "pun" > ' host ' => ' 192.168.1.3 '
< Span class= "pun" >< Span class= "pun" >< span class= "str" >
' write ' => Array ( Span class= "PLN" > ' host ' => ' 196.168.1.2 ',
‘host‘ => ‘192.168.1.4‘,
), ' Driver ' = ' MySQL ', ' Database ' = ' Database ', ' Username ' => ' root ' , ' password ' => ", ' charset ' => ' UTF8 ' , ' collation ' => Utf8_unicode_ci ' , ' prefix ' => ", ),
Laravel for database read-write separation configuration or multiple read/write separation configuration