zoukankan      html  css  js  c++  java
  • Mycat 分片规则详解--日期范围 hash 分片

    • 实现方式:其思想和范围取模分片一样,由于日期取模会出现数据热点问题,所以先根据日期分组,再根据时间 hash 使得短期数据分布跟均匀。
    • 优点:避免扩容时的数据迁移,可以在一定程度上避免范围分片的热点问题
    • 缺点:要求日期格式尽量精确,不然达不到局部均匀的目的
    • 配置示例

      <tableRule name="sharding-by-range-date-hash">

      <rule>

      <columns>create_time</columns>

      <algorithm>sharding-by-range-date-hash</algorithm>

      </rule>

      </tableRule>

      <function name="sharding-by-range-date-hash"

      class="io.mycat.route.function.PartitionByRangeDateHash">

      <property name="dateFormat">yyyy-MM-dd HH:mm:ss</property>

      <property name="sBeginDate">2018-01-31 00:00:00</property>

      <property name="sPartionDay">3</property>

      <property name="groupPartionSize">6</property>

      </function>

    • 相关属性:
      • dateFormat:日期格式,必须需要时间
      • sBeginDate:开始日期,于 dateFormat 格式一致
      • sPartionDay:代表多少天一组
      • groupPartionSize:每组的分片数量
  • 相关阅读:
    进度条加载后显示页面
    解决跨域问题
    js下IE和FF的一些兼容写法总结
    linux
    linux 批量替换文件内容
    DVWA-1.9之fileupload
    python库安装失败的解决方法
    python程序打包
    CF 1133C Balanced Team
    CF 1133B Preparation for International Women's Day
  • 原文地址:https://www.cnblogs.com/li3807/p/8461870.html
Copyright © 2011-2022 走看看