'db' => [ //主库配置 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=dddd', 'username' => 'aasd', 'password' => 'asasd@2sd6fafs', 'charset' => 'utf8mb4', //从库配置 'slaveConfig' => [ 'username' => 'ddddd', 'password' => 'idcd84fsa@aaaa', 'attributes' => [ // use a smaller connection timeout PDO::ATTR_TIMEOUT => 10, ], ], // list of slave configurations 'slaves' => [ ['dsn' => 'rm-111.mysql.rds.aliyuncs.com'], ['dsn' => 'rr-222.mysql.rds.aliyuncs.com'], ['dsn' => 'rr-333.mysql.rds.aliyuncs.com'], ['dsn' => 'rr-4444.mysql.rds.aliyuncs.com'], ], ],
yii2主从配置
最新推荐文章于 2024-03-19 12:06:53 发布