关系型数据的分布式处理系统MyCAT(2)——高级功能和管理监控

论坛 期权论坛     
选择匿名的用户   2021-6-2 17:54   291   0
<h2> <p align="center" style="text-align:center; line-height:150%"><strong><span style="font-family:黑体; line-height:150%; font-size:18pt">关系型数据的分布式处理系统MyCAT(2)</span></strong></p> <p align="right" style="text-align:right; line-height:150%"><strong><span style="font-family:黑体; line-height:150%; font-size:14pt">——高级功能和管理监控</span></strong></p> <p align="right" style="text-align:right; line-height:150%"><span style="font-family:宋体">日期:</span>2014/12/24</p> <p align="right" style="text-align:right; line-height:150%"><span style="font-family:宋体">文:阿蜜果</span></p> </h2>
<h1><span style="font-family:黑体; line-height:150%; font-size:18pt">1、<span style="font:7pt &#39;Times New Roman&#39;">   </span></span><span style="font-family:黑体; line-height:150%; font-size:18pt">高级功能</span></h1>  
<h2><span style="font-family:黑体">1.1 </span><span style="font-family:黑体">分片策略</span></h2>
<p style="line-height:150%; text-indent:21pt"><strong>MyCAT</strong><span style="font-family:宋体">通过定义表的分片规则来实现分片,每个表格可以捆绑一个分片规则,每个分片规则指定一个分片字段并绑定一个函数,来实现动态分片算法。</span></p>
<h3><span style="line-height:150%; font-size:15pt">1.1.1 </span><span style="font-family:宋体; line-height:150%; font-size:15pt">分片规则</span></h3>
<p style="line-height:150%; text-indent:21pt"><span style="font-family:宋体">以常用的基于整数映射的分片函数</span>org.MyCAT.route.function.PartitionByFileMap<span style="font-family:宋体">为例,此函数通过一个配置文件来确定映射关系,以下面的</span>sharding-by-intfile<span style="font-family:宋体">这个分片规则为例:</span></p>
<div style="border-bottom:#cccccc 1px solid; border-left:#cccccc 1px solid; padding-bottom:4px; background-color:#eeeeee; padding-left:4px; width:98%; padding-right:5px; font-size:13px; word-break:break-all; border-top:#cccccc 1px solid; border-right:#cccccc 1px solid; padding-top:4px">
<img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">tableRule </span>
<span style="color:#ff0000">name</span>
<span style="color:#0000ff">&#61;&#34;sharding-by-intfile&#34;</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">    </span>
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">rule</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">      </span>
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">columns</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000">sharding_id</span>
<span style="color:#0000ff">&lt;/</span>
<span style="color:#800000">columns</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">      </span>
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">algorithm</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000">hash-int</span>
<span style="color:#0000ff">&lt;/</span>
<span style="color:#800000">algorithm</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">    </span>
<span style="color:#0000ff">&lt;/</span>
<span style="color:#800000">rule</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif"></span>
<span style="color:#0000ff">&lt;/</span>
<span style="color:#800000">tableRule</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif"></span>
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">function </span>
<span style="color:#ff0000">name</span>
<span style="color:#0000ff">&#61;&#34;hash-int&#34;</span>
<span style="color:#ff0000"> class</span>
<span style="color:#0000ff">&#61;&#34;org.opencloudb.route.function.PartitionByFileMap&#34;</span>
<span style="color:#0000ff">&gt;</span>
<span style="color:#000000"><br> <img align="top" alt="" src="https://beijingoptbbs.oss-cn-beijing.aliyuncs.com/cs/5606289-4f1150b881333f12a311ae9ef34da474.gif">    </span>
<span style="color:#0000ff">&lt;</span>
<span style="color:#800000">property </span>
<span style="color:#ff0000">name</span>
<span style="color:#0000ff">&#61;&#34;mapFile&#34;</span>
<span style="color:#0000ff">&
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP