Blogger Information
Blog 65
fans 1
comment 1
visits 119345
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
tp5 配置 mysql 主从复制
技术宅的博客
Original
2125 people have browsed it

<?php
return [
// 数据库类型
‘type’ => ‘mysql’,
// 服务器地址
‘hostname’ => ‘192.168.0.131,192.168.0.130’, 先配置主服务器 后面接从服务器
// 数据库名
‘database’ => ‘test’,
// 用户名
‘username’ => ‘root,root’,
// 密码
‘password’ => ‘123456,123456’,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
‘deploy’ => 1,
// 数据库读写是否分离 主从式有效
‘rw_separate’ => true,
// 读写分离后 主服务器数量
‘master_num’ => 1,
];

配置好了 开启debug 看数据库的连接


这是读写同时操作是 tp5配置好后 自动切换

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post