#### 主从配置
微擎系统支持数据库的主从配置(一主多从),只需要进行简单的配置即可。
配置主从支持在系统 "data/config.php" 文件中,具体配置如下:
**注:部分用户没有master项,$config['db']['host'] 等同于 $config['db']['master']['host']**
~~~
//主库配置
$config['db']['master']['host'] = '192.168.1.2';
$config['db']['master']['username'] = 'root';
$config['db']['master']['password'] = '123456';
$config['db']['master']['port'] = '3306';
$config['db']['master']['database'] = 'we7_pro';
$config['db']['master']['charset'] = 'utf8';
$config['db']['master']['pconnect'] = 0;
$config['db']['master']['tablepre'] = 'ims_';
//以下选项,如果没有请自行添加
//从库配置
$config['db']['slave_status'] = false; //是否开启主从配置
$config['db']['slave']['1']['host'] = '192.168.1.3'; //从库配置要与主库相同
$config['db']['slave']['1']['username'] = 'root';
$config['db']['slave']['1']['password'] = '123456';
$config['db']['slave']['1']['port'] = '3306';
$config['db']['slave']['1']['database'] = 'we7_pro';
$config['db']['slave']['1']['charset'] = 'utf8';
$config['db']['slave']['1']['pconnect'] = 0;
$config['db']['slave']['1']['tablepre'] = 'ims_';
$config['db']['slave']['1']['weight'] = 0; //从库的权重值,默认0即可
//不进行主从分离的表
$config['db']['common']['slave_except_table'] = array(
'core_sessions',
);
~~~