server.xml属性概念

# system

Processers为系统可用的线程数,一般和CPU核心线程数相同

BufferPool 是由BufferChunk组成。

BufferPool的总大小为BufferChunkSize * Processers * 1000

BufferPool的总长度为 BufferPoolSize / BufferChunkSize

BufferChunk的大小默认是4096字节

关系如下图:

ThreadLocalPool 是BufferPool的二级缓存。每次获取buffer先从ThreadLocalPool中获取,如果未取到再到bufferPool中取,每个线程内部使用,为线程缓存。

processorBufferLocalPercent 是控制ThreadLocalPool 大小比例的,该值是比例值,默认100

线程缓存百分比 = bufferLocalPercent / processors 属性

processorExecutor 用于指定 NIOProcessor 上共享的 businessExecutor 固定线程池大小。

sequnceHandlerType 全局序列号类型 0 为本地文件方式,1 为数据库方式,2 为时间戳序列方式,3 为分布式ZK ID 生成器,4 为 zk 递增 id 生成。推荐用2   原因:http://blog.csdn.net/zhxdick/article/details/50667744

processorCheckPeriod 清理 NIOProcessor 上前后端空闲、超时和关闭连接的间隔时间。默认是 1 秒,单位毫秒

dataNodeIdleCheckPeriod 对后端连接进行空闲、超时检查的时间间隔,默认是 300 秒,单位毫秒。

dataNodeHeartbeatPeriod 对后端所有读、写库发起心跳的间隔时间,默认是 10 秒,单位毫秒。

bindIp 绑定mycat监听的IP,默认为0.0.0.0

serverPort : 定义 mycat 的使用端口

useGlobleTableCheck 是否开启全局表一致性检测 1-开启 0-关闭     开启了全局表一致性检测,在create表时会添加隐含的内部列_mycat_op_time来记录操作的时间戳。_mycat_op_time的类型为bigint。对全局表insert,update时mycat会拦截sql,并在sql中增加该隐含列的值。

handleDistributedTransactions  分布式事务开关 0 为不过滤分布式事务,1 为过滤分布式事务(如果分布式事务内只涉及全局表,则不过滤),2 为不过滤分布式事务,但是记录分布式事务日志。

# user 

<user name="test">
  <property name="password">test</property>
  <property name="schemas">TESTDB</property>
  <property name="readOnly">true</property>
  <property name="benchmark">11111</property>
  <property name="usingDecrypt">1</property>
  <privileges check="false">
      <schema name="TESTDB" dml="0010" showTables="custome/mysql">
          <table name="tbl_user" dml="0110"></table>
          <table name="tbl_dynamic" dml="1111"></table>
      </schema>
  </privileges>
</user>

name 用户名

# property 

password 用户密码

schemas 可访问的逻辑库,可为多个逗号分开

readonly 是否只读

benchmark 当前端的整体 connection 数达到基准值是, 对来自该账户的请求开始拒绝连接,0 或不设表示不限制

usingDecrypt  是否对密码加密默认 0 否 如需要开启配置 1,同时使用加密程序对密码加密

# privileges 对用户的 schema 及 下级的 table 进行精细化的 DML 权限控制

dml = "insert,update,select,delete"

<privileges check="true">
  <schema name="TESTDB" dml="0110" >
    <table name="table01" dml="0111"></table>
    <table name="table02" dml="1111"></table>
  </schema>
  <schema name="TESTDB1" dml="0110">
    <table name="table03" dml="1110"></table>
    <table name="table04" dml="1010"></table>
  </schema>
</privileges>

 

posted @ 2017-11-13 15:02  MysticGrrrr  阅读(424)  评论(0编辑  收藏  举报