## 基础配置 ### 数据库配置 ​ Qimall采用数据库主从架构,一主多从。 优点描述: 1.主数据库无法连接时 可设置从数据库是否 可写 2.所有从数据库无法连接时 可设置主数据库是否 可读 3.如果从数据库连接失败 可设置N秒内不再连接 ![](../img/mycart.png) ### 主库配置 在Qimall文件配置下/common/config/main-local.php目录 ```php 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=81.71.120.150;port=8066;dbname=qimall', 'username' => 'root', 'password' => '123456', 'charset' => 'utf8', 'tablePrefix' => 'qimall_' ] ``` ### redis配置 ```php 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => '127.0.0.1', 'port' => 6379, 'password' => '123456', 'retries' => 3 ] ```