About the configuration of the mycat sub-library

1. stop mycat

``` ./bin/mycat stop ```

2. Clear the configuration file

``` rm -rf logs/* ```

3. schema.xml

1. 配置 schema 标签
    *. schema 标签 会被mycat 影射成数据库,所以在各个项目中配置的数据库名称为schema 标签下的name属性
    *. table 标签,name属性:默认填写表名,dataNode属性: 配置的是分片节点,分片节点下方会有说明。rule 属性:默认默认配置 “sharding-by-murmur”(数据一致性分片)。
2. 配置 dataNode 标签
    *. dataNode 标签配置的数量,要与上方的schema 标签下的table 标签内的dataNode属性一致(dataNode属性配置了多少个name,下方的 dataNode 标签就需要配置多少个)
    *. dataHost 属性:配置的是实质的数据库连接;database 属性:配置的是实质的数据库名称 

4. server.xml

    1. 配置user 标签
        *. name 属性:映射到mycat 实例的连接名称,默认配置项目名称
        *. property 标签:各种属性配置
        *. password:mycat 实例的连接密码,默认配置原先密码
        *. shchemas:mycat 实例的数据库实例
        *. benchmark:benchmark 基准, 当前端的整体connection数达到基准值是, 对来自该账户的请求开始拒绝连接,0或不设表示不限制

5. After the configuration is complete, configure the user label. In the property label under the user label whose name is root, add the schemas just configured to the schemas, so that the root account can access the database just configured.

6. Restart mycat

``` ./bin/mycat start ```

7. Check if the restart is successful

``` ps -ef|grep mycat ```

8. Configure the project

只需要修改配置文件的mycat连接,将端口号修改为8066,重启项目即可

9. Description:

Mysql数据库内的原有数据库备份数据,然后然后删除数据库,重新建立数据库(需要以为 zhime-xxx0,zhime-xxx1,这样的命名数据库),默认三个,如果有特殊的需求,需要查看[mycat官网](http://mycat.io/)的[《mycat权威指南》](http://mycat.io/document/Mycat_V1.6.0.pdf),进行配置。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325112755&siteId=291194637