mysql的中间件amoeba-for-mysql

MySql 码拜 11年前 (2014-04-27) 1104次浏览 0个评论

大家看下,我下面的amoeba设置,我在rule.xml中的 tableRule 设置为:

name=”table01″ schema=”database01″ defaultPools=”amoeba,master”

然后:下面的规则我设置为:
rule1:
user_id<=100的
 <defaultPools>amoeba</defaultPools>
                        <readPools>amoeba</readPools>
                        <writePools>amoeba</writePools>
rule2:
user_id>100的

     <defaultPools>master</defaultPools>
                        <writePools>master</writePools>
                        <readPools>master</readPools>

然后我在另外一台PC机上登陆amoeba-for-mysql,然后发送这样的SQL语句:

insert into database01.table01(lWindField) values(99);

按理,应该是table01和database01 命中规则tableRule,进入rule判断,
99 <100,所以命中rule1,这样的话,应该只路由到amoeba数据库,但是我发现amoeba-for-mysql路由到了 amoeba和master数据库!

我发送insert into database01.table01(lWindField) values(222);

也是一样,这是为什么??

不是不命中rule1、rule2……中的一条,才会插入到defaultPools=”amoeba,master” 么?

<?xml version=”1.0″ encoding=”gbk”?>
<!DOCTYPE amoeba:rule SYSTEM “rule.dtd”>

<amoeba:rule xmlns:amoeba=”http://amoeba.meidusa.com/”>
        <tableRule name=”table01″ schema=”database01″ defaultPools=”amoeba,master”>

                <rule name=”rule1″>
                        <parameters>lWindFiledId</parameters>
                        <expression><![CDATA[ user_id<=100]]></expression>
                        <defaultPools>amoeba</defaultPools>
                        <readPools>amoeba</readPools>
                        <writePools>amoeba</writePools>
                </rule>
    
                <rule name=”rule2″>
                        <parameters>lWindFiledId</parameters>
                        <expression><![CDATA[user_id>100 ]]></expression>
                        <defaultPools>master</defaultPools>
                        <writePools>master</writePools>
                        <readPools>master</readPools>
                </rule> 
        
</tableRule>

30分
rule 配置的字段 要跟 sql语句的字段一致

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明mysql的中间件amoeba-for-mysql
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!