laravel多主多从配置示例

'mysql' => [  
    'write'    => [  
        [
            'host' => '192.168.1.180',
            'username'  => '',
            'password'  => '',
        ],  
    ],  
    'read'     => [  
        [
            'host' => '192.168.1.182',
            'username'  => '',
            'password'  => '',
        ],  
        [
            'host' => '192.168.1.179',
            'username'  => '',
            'password'  => '',
        ],  
    ],  
    'driver'    => 'mysql',  
    'database'  => 'database',     
    'charset'   => 'utf8',  
    'collation' => 'utf8_unicode_ci',  
    'prefix'    => '', 
] 

 

验证
开启MySQL的general-log,通过tail -f的方式监控log变化来确定配置是否生效

 

posted on 2017-07-05 13:42  dongruiha  阅读(489)  评论(0编辑  收藏  举报

导航