MySQL中间件Spider引擎问题集锦

最近在测试MySQL中间件Tspider时发现一些问题,但因为spider引擎使用者少,网上关于spider引擎的问题解答非常少,所以做个整理积累:

create table db.tb ENGINE=SPIDER DEFAULT CHARSET=gbk PARTITION BY KEY (id) PARTITIONS 2 (PARTITION pt0 COMMENT = 'database "db", table "tb ", server "test_1"' ENGINE = SPIDER,PARTITION pt2  COMMENT = 'database "db", table "tb ", server "test_2"' ENGINE = SPIDER);   
ERROR 1488 (HY000): Field in list of fields for partition function not found in table   

其实原因很简单:
就是comment里的指定远端连接的库表时表名多了个空格,"tb "-->"tb"就行了,o(╯□╰)o

mysql> create table test.test(id int primary key,num int) ENGINE=SPIDER DEFAULT CHARSET=gbk PARTITION BY LIST (crc32(id)%4) (PARTITION pt0 VALUES IN (0) COMMENT = 'database "test", table "test", server "remote_1"' ENGINE = SPIDER, PARTITION pt1 VALUES IN (1) COMMENT = 'database "test", table "test", server "remote_2"' ENGINE = SPIDER,PARTITION pt2 VALUES IN (2) COMMENT = 'database "test", table "test", server "remote_3"' ENGINE = SPIDER,PARTITION pt3 VALUES IN (3) COMMENT = 'database "test", table "test", server "remote_4"' ENGINE = SPIDER);   
ERROR 1477 (HY000): The foreign server name you are trying to reference does not exist. Data source error:  test_1   

乍一看莫名其妙--创建语句没使用test_1这个远端server呀,其实报错与这条建表语句没关系;是mysql.servers系统表不包含test_1这个远端server记录了,但又有现存其他表引用了test_1,解决办法就是:更改引用了test_1的表使之引用mysql.servers里的有效远端server或者将test_1添加到mysql.servers里

你可能感兴趣的:(MySQL中间件Spider引擎问题集锦)