6 月 042014
 

相关url:https://github.com/alibaba/cobar

管理界面

mysql -h 192.168.1.80 -utest -ptest -P9066

重新载入

reload @@config;

 

cobar rule

<!– 路由函数定义 –>
<function name=”func1″ class=”com.alibaba.cobar.route.function.PartitionByLong”>
<property name=”partitionCount”>4</property>
<property name=”partitionLength”>256</property>
</function>

int规则,分4个库,256个一切割

<function name=”func2″ class=”com.alibaba.cobar.route.function.PartitionByString”>
<property name=”partitionCount”>4</property>
<property name=”partitionLength”>256</property>
</function>

字符规则,hash值,分4个库,256一切割,可能不是很均衡。

<tableRule name=”ruleByRoomActivityId”>
<rule>
<columns>room_activity_id</columns>
<algorithm><![CDATA[ func1(${room_activity_id}) ]]></algorithm>
</rule>
</tableRule>

 

ruleByRoomActivityId 规则以room_activity_id 切分。按照func1 的规则。

 

<table name=”private_message_status” dataNode=”dn_shanliao$0-3″ rule=”ruleByUserId”/>

private_message_status 切分的规则是按 ruleByUserId。

 

其他的可以参照官方文档。(或者看页首的相关url)

[gview file=”https://www.hmouse.cn/wp-content/uploads/2014/06/Cobar-Alibaba-Open-Sesame1.pdf”]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny