https://github.com/alibaba/cobar
Cobar是关系型数据的分布式处理系统,它可以在分布式的环境下看上去像传统数据库一样为您提供海量数据服
务。
<!--数据源定义,数据源是一个具体的后端数据连接的表示。-->
<dataSourcename="dsTest" type="mysql">
<property name="location">
<location>192.168.1.33:3306/dbtest1</location>
<location>192.168.1.33:3306/dbtest2</location>
<location>192.168.1.33:3306/dbtest3</location>
</property>
<property name="user">root</property>
<property name="password">xxxx</property>
<propertyname="sqlMode">STRICT_TRANS_TABLES</property>
</dataSource>
<!--用户访问定义,用户名、密码、schema等信息。 -->
<username="dingsai88">
<property name="password">888888</property>
<propertyname="schemas">dbtest</property>
</user>
dropdatabase if exists dbtest1;
createdatabase dbtest1;
usedbtest1;
createtable tb1(id int not null,gmt datetime);
dropdatabase if exists dbtest2;
createdatabase dbtest2;
usedbtest2;
createtable tb2(id int not null,val varchar(256));
dropdatabase if exists dbtest3;
createdatabase dbtest3;
usedbtest3;
createtable tb2(id int not null,val varchar(256));
C:\ProgramFiles\MySQL\MySQL Server 5.1\bin>mysql -hlocalhost -P8066 -udingsai88
-p
Enterpassword: ******
Welcometo the MySQL monitor. Commands end with; or \g.
YourMySQL connection id is 2 to server version: 5.1.48-cobar-1.2.7
Type'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use dbtest;
Databasechanged
mysql>show tables;
+------------------+
|Tables_in_dbtest |
+------------------+
|tb2 |
|tb1 |
+------------------+
2rows in set (0.50 sec)
mysql>
insertinto tb1(id,gmt)values(1,now());
insertinto tb2(id,val)values(1,"part1");
insertinto tb2(id,val)values(2,"part1"),(513,"part2");
mysql>select * from tb2;
+-----+-------+
|id | val |
+-----+-------+
| 1 | part1 |
| 2 | part1 |
|513 | part2 |
+-----+-------+
3rows in set (0.09 sec)
mysql>select * from tb2 where id in(1,513);
+-----+-------+
|id | val |
+-----+-------+
|513 | part2 |
| 1 | part1 |
+-----+-------+
2rows in set (0.03 sec)
mysql>select * from tb1 where id in (select id from tb2);
ERROR1146 (HY000): Table 'dbtest2.tb1' doesn't exist
mysql>