码迷,mamicode.com
首页 > 数据库 > 详细

laravel实现数据库读写分离配置或者多读写分离配置

时间:2014-09-22 12:30:02      阅读:1678      评论:0      收藏:0      [点我收藏+]

标签:io   os   ar   数据   sp   on   c   ad   ef   

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‘ => ‘‘, ),
 
 

laravel实现数据库读写分离配置或者多读写分离配置

标签:io   os   ar   数据   sp   on   c   ad   ef   

原文地址:http://www.cnblogs.com/steven9801/p/3985545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!