微擎mysql主从同步_主从配置

#### 主从配置

微擎系统支持数据库的主从配置(一主多从),只需要进行简单的配置即可。

配置主从支持在系统 "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',

);

~~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值