赞
踩
配置文件路径:
/data/config.php
修改方法:
修改对应数组的参数即可生效。
数据库配置
微擎系统支持数据库的主从配置(一主多从),只需要进行简单的配置即可。
变量描述$config[‘db’][‘master’][‘host’]数据库主机地址$config[‘db’][‘master’][‘username’]数据库用户名$config[‘db’][‘master’][‘password’]数据库密码$config[‘db’][‘master’][‘port’]数据库端口$config[‘db’][‘master’][‘database’]数据库名$config[‘db’][‘master’][‘charset’]数据库编码$config[‘db’][‘master’][‘pconnect’]数据库连接类型$config[‘db’][‘master’][‘tablepre’]数据库表前缀$config[‘db’][‘slave_status’]读写分离开关$config[‘db’][‘slave’][‘1’]只读实例配置项,1为只读实例编码,多台实例可新增[2],[3],[4]$config[‘db’][‘common’][‘slave_except_table’]不进行主从分离的表
配置主从支持在系统 “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',
);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。