淘宝分布式关系数据库处理系统---Cobar配置说明

来源:互联网 发布:c语言结束符 编辑:程序博客网 时间:2024/05/22 20:47

Cobar淘宝

 

下载Cobar:

https://github.com/alibaba/cobar

 

 

功能概述:

Cobar是关系型数据的分布式处理系统,它可以在分布式的环境下看上去像传统数据库一样为您提供海量数据服

务。

 

 

 

目录介绍:

 

Bin目录

 

 

 

Conf目录

 


 

文件配置:

 

Schema.xml

 

 

<!--数据源定义,数据源是一个具体的后端数据连接的表示。-->

<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>

 

 

Server.xml

<!--用户访问定义,用户名、密码、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>










0 0