Mycat分布式数据库架构解决方案--Server.xml详解

echo编辑整理,欢迎转载,转载请声明文章来源。欢迎添加echo微信(微信号:t2421499075)交流学习。 百战不败,依不自称常胜,百败不颓,依能奋力前行。——这才是真正的堪称强大!!!


该文件是一个包含Mycat的系统配置信息文件,对应的原码是SystemConfig.java。我们对该文件做一个详解,该文件在我们安装包中,/mycat/conf中(该文是基于“Mycat分布式数据库架构解决方案--Linux安装运行Mycat”)的后续,可以了解安装之后目录结构。想要对比详细配置文件也可以直接去github下载mycat源码,下载地址:https://github.com/MyCATApache/Mycat-Server

<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License");
    - you may not use this file except in compliance with the License. - You
    may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0
    - - Unless required by applicable law or agreed to in writing, software -
    distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the
    License for the specific language governing permissions and - limitations
    under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
    <!-- Mycat中有两个重要的标签,分别是user、system -->
    <!-- system标签与系统配置有关 -->
    <system>
        <!-- 配置该属性的时候一定要保证mycat的字符集和mysql 的字符集是一致的。
        如果需要配置特殊字符集,如:utf8mb4,则可以在index_to_charset.properties中配置,配置格式
        为“ID=字符集”,例如:“224=utf8mb4”-->
        <property name="charset">utf8</property>
        <!-- 1为开启实时统计、0为关闭 -->
        <property name="useSqlStat">0</property>
        <!-- 0为需要密码登陆、1为不需要密码登陆 ,默认为0,设置为1则需要指定默认账户-->
        <property name="nonePasswordLogin">0</property>
        <property name="useHandshakeV10">1</property>
        <!-- 1为开启全加班一致性检测、0为关闭 -->
        <property name="useGlobleTableCheck">0</property>
        <!-- SQL 执行超时 单位:秒-->
        <property name="sqlExecuteTimeout">300</property>
        <!-- 指定使用 Mycat 全局序列的类型。 0 为本地文件方式,1 为数据库方式,2 为时间戳序列方式,3 为分布式ZK ID 生成器,4 为 zk 递增 id 生成。 -->
        <property name="sequnceHandlerType">5</property>
        <!-- 必须带有MYCATSEQ_或者 mycatseq_进入序列匹配流程 注意MYCATSEQ_有空格的情况 -->
        <property name="sequnceHandlerPattern">(?:(\s*next\s+value\s+for\s*MYCATSEQ_(\w+))(,|\)|\s)*)+</property>
        <!-- 子查询中存在关联查询的情况下,检查关联字段中是否有分片字段 .默认 false -->
        <property name="subqueryRelationshipCheck">false</property>
        <property name="sequenceHanlderClass">io.mycat.route.sequence.handler.HttpIncrSequenceHandler</property>
        <!-- 默认为type 0: DirectByteBufferPool | type 1 ByteBufferArena | type 2 NettyBufferPool -->
        <property name="processorBufferPoolType">0</property>
        <!-- 分布式事务开关,0为不过滤分布式事务,1为过滤分布式事务(如果分布式事务内只涉及全局表,则不过滤),2为不过滤分布式事务,但是记录分布式事务日志-->
        <property name="handleDistributedTransactions">0</property>
        <!-- off heap for merge/order/group/limit      1开启   0关闭 -->
        <property name="useOffHeapForMerge">0</property>
        <!-- 单位为m -->
        <property name="memoryPageSize">64k</property>
        <!-- 单位为k -->
        <property name="spillsFileBufferSize">1k</property>
        <property name="useStreamOutput">0</property>
        <!-- 单位为m -->
        <property name="systemReserveMemorySize">384m</property>
        <!--是否采用zookeeper协调切换  -->
        <property name="useZKSwitch">false</property>
        <!--如果为 true的话 严格遵守隔离级别,不会在仅仅只有select语句的时候在事务中切换连接-->
        <property name="strictTxIsolation">false</property>
        <property name="useZKSwitch">true</property>
    </system>
    
    <!-- user标签主要用于定义登录Mycat的用户和权限 -->
    <!-- name="root" 定义登录用户名 -->
    <user name="root" defaultAccount="true">
        <!-- 定义了登录密码 -->
        <property name="password">123456</property>
        <property name="schemas">scott</property>
        <!-- true:只读 false:读写都有 -->
        <property name="readOnly">true</property>
        <!-- 限制前端的整体连接数量,如果值为0或者不设置,则表示不限制连接数量 -->
        <property name="banchmark">1000</property>
        <!-- 0不对密码进行加密,1对密码进行加密 -->
        <property name="usingDecrypt">0</property>
    </user>
    <user name="user">
        <property name="password">user</property>
        <property name="schemas">scott</property>
        <property name="readOnly">true</property>
    </user>
</mycat:server>

做一个有底线的博客主

猜你喜欢

转载自www.cnblogs.com/xlecho/p/11796580.html