config\database.php里

读写分离:
'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',
     'host' => '192.168.1.3',

), 'write' => array( 'host' => '196.168.1.2',
 'host' => '192.168.1.4',

), 'driver' => 'mysql', 'database' => 'database', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),
 
 

相关文章:

  • 2021-10-28
  • 2022-12-23
  • 2022-01-18
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
猜你喜欢
  • 2022-02-21
  • 2021-11-30
  • 2022-01-07
  • 2021-08-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案