用cobar搭建分布式数据库 .

article/2025/9/17 14:52:11

周末针对最新的项目需求进行cobar的搭建并针对实际状况做了demo演示

一、需求

1、大数据量,邮件发送记录需要记录,一年可能累计4亿的数据

2、需要按照邮箱进行邮件发送明细的查询以及发送记录的查询


二、问题

1、单库分表分区已经解决不了存储以及查询问题

2、只能进行一致性hash的策略进行数据存储以及查询,放弃了一些便利性查询统计


三、实施方案,数据库采用mysql,使用cobar针对分区库和主库进行整合

整合步骤如图,看不清可以下载附件看


四、相关配置文件以及工具文件如下

1、操作指南:edm-cobar操作指南.txt

[html] view plain copy print ?
  1. 1、mysql -h192.168.20.65 -uroot -p1q2w3e -P8066  
  2. 2、show databases;  
  3. 3、use edm;  
  4. 4、show tables;  
  5.   
  6.   
  7.   
  8. note:  
  9. 1、cobar server作为代理,安装在20.65上,并且以root/1q2w3e为口令,8066为服务端口提供了数据库代理服务  
  10. 具体路径/usr/local/cobar***  
  11. 2、我们的数据库可以以这个代理服务器为访问端口,按照email这个字符串进行水平的hash路由到各个水平节点上  
  12. 3、对于不需要水平拆分的表,我们也可以直接通过20.65提供的这个edm服务访问  
  13.   
  14. warning:  
  15. 1、直接用sqlyog软件访问这个代理数据库可能会报错,因为获取数据问题。不过我们可以直接通过cmd来查询。  
  16. 2、我们的数据校验,可以通过直接访问各个节点进行数据校验  
  17.    
1、mysql -h192.168.20.65 -uroot -p1q2w3e -P8066
2、show databases;
3、use edm;
4、show tables;
note:
1、cobar server作为代理,安装在20.65上,并且以root/1q2w3e为口令,8066为服务端口提供了数据库代理服务
具体路径/usr/local/cobar***
2、我们的数据库可以以这个代理服务器为访问端口,按照email这个字符串进行水平的hash路由到各个水平节点上
3、对于不需要水平拆分的表,我们也可以直接通过20.65提供的这个edm服务访问
warning:
1、直接用sqlyog软件访问这个代理数据库可能会报错,因为获取数据问题。不过我们可以直接通过cmd来查询。
2、我们的数据校验,可以通过直接访问各个节点进行数据校验


2、实施策略图片:EDM分布式数据库策略之Cobar.jpeg


3、cobar的相关配置文件:rule.xml,schema.xml,server.xml

[html] view plain copy print ?
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!--  
  3.  - Copyright 1999-2012 Alibaba Group.  
  4.  -    
  5.  - Licensed under the Apache License, Version 2.0 (the "License");  
  6.  - you may not use this file except in compliance with the License.  
  7.  - You may obtain a copy of the License at  
  8.  -    
  9.  -      http://www.apache.org/licenses/LICENSE-2.0  
  10.  -    
  11.  - Unless required by applicable law or agreed to in writing, software  
  12.  - distributed under the License is distributed on an "AS IS" BASIS,  
  13.  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  14.  - See the License for the specific language governing permissions and  
  15.  - limitations under the License.  
  16. -->  
  17. <!DOCTYPE cobar:schema SYSTEM "schema.dtd">  
  18. <cobar:schema xmlns:cobar="http://cobar.alibaba.com/">  
  19.   
  20.   <!-- schema定义 -->  
  21.   <schema name="edm" dataNode="dnEdm">  
  22.     <table name="email_info" dataNode="dn_shardx$0-7,dn_shardy$0-7" rule="email_rule" />  
  23.     <table name="email_info_detail" dataNode="dn_shardx$0-7,dn_shardy$0-7" rule="email_rule" />  
  24.   </schema>  
  25.   
  26.   <!-- 数据节点定义,数据节点由数据源和其他一些参数组织而成。-->  
  27.   <dataNode name="dnEdm">  
  28.     <property name="dataSource">  
  29.       <dataSourceRef>db_edmx[0]</dataSourceRef>  
  30.     </property>  
  31.   </dataNode>  
  32.   
  33.   <dataNode name="dn_shardx">  
  34.     <property name="dataSource">  
  35.       <dataSourceRef>db_edmx$1-8</dataSourceRef>  
  36.     </property>  
  37.   </dataNode>  
  38.   
  39.   <dataNode name="dn_shardy">  
  40.     <property name="dataSource">  
  41.       <dataSourceRef>db_edmy$0-7</dataSourceRef>  
  42.     </property>  
  43.   </dataNode>  
  44.   
  45.   <!-- 数据源定义,数据源是一个具体的后端数据连接的表示。-->  
  46.   <dataSource name="db_edmx" type="mysql">  
  47.     <property name="location">  
  48.       <!--edm  总库-->  
  49.       <location>192.168.20.182:3306/edm_hd</location>  
  50.   
  51.       <location>192.168.20.182:3306/edmshard$1-8</location>  
  52.   
  53.     </property>  
  54.     <property name="user">root</property>  
  55.     <property name="password">your_password</property>  
  56.     <property name="sqlMode">STRICT_TRANS_TABLES</property>  
  57.   </dataSource>  
  58.   
  59.   <dataSource name="db_edmy" type="mysql">  
  60.     <property name="location">  
  61.       <location>192.168.119.158:3306/edmshard$9-16</location>  
  62.     </property>  
  63.     <property name="user">root</property>  
  64.     <property name="password">your_password</property>  
  65.     <property name="sqlMode">STRICT_TRANS_TABLES</property>  
  66.   </dataSource>  
  67. </cobar:schema>  
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2012 Alibaba Group.
-  
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-  
-      http://www.apache.org/licenses/LICENSE-2.0
-  
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<!DOCTYPE cobar:schema SYSTEM "schema.dtd">
<cobar:schema xmlns:cobar="http://cobar.alibaba.com/">
<!-- schema定义 -->
<schema name="edm" dataNode="dnEdm">
<table name="email_info" dataNode="dn_shardx$0-7,dn_shardy$0-7" rule="email_rule" />
<table name="email_info_detail" dataNode="dn_shardx$0-7,dn_shardy$0-7" rule="email_rule" />
</schema>
<!-- 数据节点定义,数据节点由数据源和其他一些参数组织而成。-->
<dataNode name="dnEdm">
<property name="dataSource">
<dataSourceRef>db_edmx[0]</dataSourceRef>
</property>
</dataNode>
<dataNode name="dn_shardx">
<property name="dataSource">
<dataSourceRef>db_edmx$1-8</dataSourceRef>
</property>
</dataNode>
<dataNode name="dn_shardy">
<property name="dataSource">
<dataSourceRef>db_edmy$0-7</dataSourceRef>
</property>
</dataNode>
<!-- 数据源定义,数据源是一个具体的后端数据连接的表示。-->
<dataSource name="db_edmx" type="mysql">
<property name="location">
<!--edm  总库-->
<location>192.168.20.182:3306/edm_hd</location>
<location>192.168.20.182:3306/edmshard$1-8</location>
</property>
<property name="user">root</property>
<property name="password">your_password</property>
<property name="sqlMode">STRICT_TRANS_TABLES</property>
</dataSource>
<dataSource name="db_edmy" type="mysql">
<property name="location">
<location>192.168.119.158:3306/edmshard$9-16</location>
</property>
<property name="user">root</property>
<property name="password">your_password</property>
<property name="sqlMode">STRICT_TRANS_TABLES</property>
</dataSource>
</cobar:schema>

[html] view plain copy print ?
  1. <!DOCTYPE cobar:rule SYSTEM "rule.dtd">  
  2. <cobar:rule xmlns:cobar="http://cobar.alibaba.com/">  
  3.   
  4.   <!-- 路由规则定义,定义什么表,什么字段,采用什么路由算法 -->  
  5.   <tableRule name="email_rule">  
  6.     <rule>  
  7.       <columns>email</columns>  
  8.       <algorithm><![CDATA[ efunc(${email}) ]]></algorithm>  
  9.     </rule>  
  10.   </tableRule>  
  11.   
  12.   <!-- 路由函数定义 -->  
  13.   <function name="efunc" class="com.alibaba.cobar.route.function.PartitionByString">  
  14.     <property name="partitionCount">16</property>  
  15.     <property name="partitionLength">64</property>  
  16.   </function>  
  17.   
  18. </cobar:rule>  
<!DOCTYPE cobar:rule SYSTEM "rule.dtd">
<cobar:rule xmlns:cobar="http://cobar.alibaba.com/">
<!-- 路由规则定义,定义什么表,什么字段,采用什么路由算法 -->
<tableRule name="email_rule">
<rule>
<columns>email</columns>
<algorithm><![CDATA[ efunc(${email}) ]]></algorithm>
</rule>
</tableRule>
<!-- 路由函数定义 -->
<function name="efunc" class="com.alibaba.cobar.route.function.PartitionByString">
<property name="partitionCount">16</property>
<property name="partitionLength">64</property>
</function>
</cobar:rule>

[html] view plain copy print ?
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <!--  
  3.  - Copyright 1999-2012 Alibaba Group.  
  4.  -    
  5.  - Licensed under the Apache License, Version 2.0 (the "License");  
  6.  - you may not use this file except in compliance with the License.  
  7.  - You may obtain a copy of the License at  
  8.  -    
  9.  -      http://www.apache.org/licenses/LICENSE-2.0  
  10.  -    
  11.  - Unless required by applicable law or agreed to in writing, software  
  12.  - distributed under the License is distributed on an "AS IS" BASIS,  
  13.  - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  14.  - See the License for the specific language governing permissions and  
  15.  - limitations under the License.  
  16. -->  
  17. <!DOCTYPE cobar:server SYSTEM "server.dtd">  
  18. <cobar:server xmlns:cobar="http://cobar.alibaba.com/">  
  19.     
  20.   <!-- 系统参数定义,服务端口、管理端口,处理器个数、线程池等。 -->  
  21.   <!--  
  22.   <system>  
  23.     <property name="serverPort">8066</property>  
  24.     <property name="managerPort">9066</property>  
  25.     <property name="initExecutor">16</property>  
  26.     <property name="timerExecutor">4</property>  
  27.     <property name="managerExecutor">4</property>  
  28.     <property name="processors">4</property>  
  29.     <property name="processorHandler">8</property>  
  30.     <property name="processorExecutor">8</property>  
  31.     <property name="clusterHeartbeatUser">_HEARTBEAT_USER_</property>  
  32.     <property name="clusterHeartbeatPass">_HEARTBEAT_PASS_</property>  
  33.   </system>  
  34.   -->  
  35.   
  36.   <!-- 用户访问定义,用户名、密码、schema等信息。 -->  
  37.   <user name="root">  
  38.     <property name="password">1q2w3e</property>  
  39.     <property name="schemas">edm</property>  
  40.   </user>  
  41.   <!--  
  42.   <user name="root">  
  43.     <property name="password"></property>  
  44.   </user>  
  45.   -->  
  46.   
  47.   <!-- 集群列表定义,指定集群节点的主机和权重,用于集群间的心跳和客户端负载均衡。 -->  
  48.   <!--   
  49.   <cluster>  
  50.     <node name="cobar1">  
  51.       <property name="host">127.0.0.1</property>  
  52.       <property name="weight">1</property>  
  53.     </node>  
  54.   </cluster>  
  55.    -->  
  56.      
  57.   <!-- 隔离区定义,可以限定某个主机上只允许某个用户登录。 -->  
  58.   <!--  
  59.   <quarantine>  
  60.     <host name="1.2.3.4">  
  61.       <property name="user">test</property>  
  62.     </host>  
  63.   </quarantine>  
  64.   -->  
  65.   
  66. </cobar:server>  
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright 1999-2012 Alibaba Group.
-  
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-  
-      http://www.apache.org/licenses/LICENSE-2.0
-  
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-->
<!DOCTYPE cobar:server SYSTEM "server.dtd">
<cobar:server xmlns:cobar="http://cobar.alibaba.com/">
<!-- 系统参数定义,服务端口、管理端口,处理器个数、线程池等。 -->
<!--
<system>
<property name="serverPort">8066</property>
<property name="managerPort">9066</property>
<property name="initExecutor">16</property>
<property name="timerExecutor">4</property>
<property name="managerExecutor">4</property>
<property name="processors">4</property>
<property name="processorHandler">8</property>
<property name="processorExecutor">8</property>
<property name="clusterHeartbeatUser">_HEARTBEAT_USER_</property>
<property name="clusterHeartbeatPass">_HEARTBEAT_PASS_</property>
</system>
-->
<!-- 用户访问定义,用户名、密码、schema等信息。 -->
<user name="root">
<property name="password">1q2w3e</property>
<property name="schemas">edm</property>
</user>
<!--
<user name="root">
<property name="password"></property>
</user>
-->
<!-- 集群列表定义,指定集群节点的主机和权重,用于集群间的心跳和客户端负载均衡。 -->
<!-- 
<cluster>
<node name="cobar1">
<property name="host">127.0.0.1</property>
<property name="weight">1</property>
</node>
</cluster>
-->
<!-- 隔离区定义,可以限定某个主机上只允许某个用户登录。 -->
<!--
<quarantine>
<host name="1.2.3.4">
<property name="user">test</property>
</host>
</quarantine>
-->
</cobar:server>


4、测试数据文件:edm_demo.sql

use edm;
/**=====================在cobar server的schema(edm)的root账号下,直接清理数据=============================**/
delete from edm_users;
delete from email_info;
delete from email_info_detail;
/**======================在cobar server的schema(edm)的root账号下,直接写入非分区库edm_hd中的edm_users 100条数据============================**/
use edm;
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd0','edm_hd0@hc360.com','psw0','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd1','edm_hd1@hc360.com','psw1','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd2','edm_hd2@hc360.com','psw2','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd3','edm_hd3@hc360.com','psw3','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd4','edm_hd4@hc360.com','psw4','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd5','edm_hd5@hc360.com','psw5','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd6','edm_hd6@hc360.com','psw6','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd7','edm_hd7@hc360.com','psw7','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd8','edm_hd8@hc360.com','psw8','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd9','edm_hd9@hc360.com','psw9','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd10','edm_hd10@hc360.com','psw10','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd11','edm_hd11@hc360.com','psw11','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd12','edm_hd12@hc360.com','psw12','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd13','edm_hd13@hc360.com','psw13','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd14','edm_hd14@hc360.com','psw14','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd15','edm_hd15@hc360.com','psw15','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd16','edm_hd16@hc360.com','psw16','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd17','edm_hd17@hc360.com','psw17','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd18','edm_hd18@hc360.com','psw18','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd19','edm_hd19@hc360.com','psw19','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd20','edm_hd20@hc360.com','psw20','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd21','edm_hd21@hc360.com','psw21','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd22','edm_hd22@hc360.com','psw22','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd23','edm_hd23@hc360.com','psw23','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd24','edm_hd24@hc360.com','psw24','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd25','edm_hd25@hc360.com','psw25','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd26','edm_hd26@hc360.com','psw26','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd27','edm_hd27@hc360.com','psw27','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd28','edm_hd28@hc360.com','psw28','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd29','edm_hd29@hc360.com','psw29','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd30','edm_hd30@hc360.com','psw30','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd31','edm_hd31@hc360.com','psw31','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd32','edm_hd32@hc360.com','psw32','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd33','edm_hd33@hc360.com','psw33','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd34','edm_hd34@hc360.com','psw34','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd35','edm_hd35@hc360.com','psw35','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd36','edm_hd36@hc360.com','psw36','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd37','edm_hd37@hc360.com','psw37','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd38','edm_hd38@hc360.com','psw38','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd39','edm_hd39@hc360.com','psw39','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd40','edm_hd40@hc360.com','psw40','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd41','edm_hd41@hc360.com','psw41','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd42','edm_hd42@hc360.com','psw42','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd43','edm_hd43@hc360.com','psw43','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd44','edm_hd44@hc360.com','psw44','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd45','edm_hd45@hc360.com','psw45','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd46','edm_hd46@hc360.com','psw46','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd47','edm_hd47@hc360.com','psw47','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd48','edm_hd48@hc360.com','psw48','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd49','edm_hd49@hc360.com','psw49','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd50','edm_hd50@hc360.com','psw50','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd51','edm_hd51@hc360.com','psw51','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd52','edm_hd52@hc360.com','psw52','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd53','edm_hd53@hc360.com','psw53','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd54','edm_hd54@hc360.com','psw54','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd55','edm_hd55@hc360.com','psw55','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd56','edm_hd56@hc360.com','psw56','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd57','edm_hd57@hc360.com','psw57','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd58','edm_hd58@hc360.com','psw58','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd59','edm_hd59@hc360.com','psw59','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd60','edm_hd60@hc360.com','psw60','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd61','edm_hd61@hc360.com','psw61','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd62','edm_hd62@hc360.com','psw62','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd63','edm_hd63@hc360.com','psw63','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd64','edm_hd64@hc360.com','psw64','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd65','edm_hd65@hc360.com','psw65','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd66','edm_hd66@hc360.com','psw66','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd67','edm_hd67@hc360.com','psw67','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd68','edm_hd68@hc360.com','psw68','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd69','edm_hd69@hc360.com','psw69','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd70','edm_hd70@hc360.com','psw70','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd71','edm_hd71@hc360.com','psw71','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd72','edm_hd72@hc360.com','psw72','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd73','edm_hd73@hc360.com','psw73','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd74','edm_hd74@hc360.com','psw74','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd75','edm_hd75@hc360.com','psw75','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd76','edm_hd76@hc360.com','psw76','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd77','edm_hd77@hc360.com','psw77','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd78','edm_hd78@hc360.com','psw78','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd79','edm_hd79@hc360.com','psw79','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd80','edm_hd80@hc360.com','psw80','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd81','edm_hd81@hc360.com','psw81','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd82','edm_hd82@hc360.com','psw82','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd83','edm_hd83@hc360.com','psw83','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd84','edm_hd84@hc360.com','psw84','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd85','edm_hd85@hc360.com','psw85','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd86','edm_hd86@hc360.com','psw86','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd87','edm_hd87@hc360.com','psw87','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd88','edm_hd88@hc360.com','psw88','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd89','edm_hd89@hc360.com','psw89','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd90','edm_hd90@hc360.com','psw90','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd91','edm_hd91@hc360.com','psw91','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd92','edm_hd92@hc360.com','psw92','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd93','edm_hd93@hc360.com','psw93','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd94','edm_hd94@hc360.com','psw94','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd95','edm_hd95@hc360.com','psw95','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd96','edm_hd96@hc360.com','psw96','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd97','edm_hd97@hc360.com','psw97','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd98','edm_hd98@hc360.com','psw98','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd99','edm_hd99@hc360.com','psw99','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));
/**=====================在cobar server的schema(edm)的root账号下,向水平分区的email_info写入100条数据=============================**/
insert  into email_info(email,num,note) values ('hdedm0@hc360.com',0,'aa');
insert  into email_info(email,num,note) values ('hdedm1@hc360.com',1,'aa');
insert  into email_info(email,num,note) values ('hdedm2@hc360.com',2,'aa');
insert  into email_info(email,num,note) values ('hdedm3@hc360.com',3,'aa');
insert  into email_info(email,num,note) values ('hdedm4@hc360.com',4,'aa');
insert  into email_info(email,num,note) values ('hdedm5@hc360.com',5,'aa');
insert  into email_info(email,num,note) values ('hdedm6@hc360.com',6,'aa');
insert  into email_info(email,num,note) values ('hdedm7@hc360.com',7,'aa');
insert  into email_info(email,num,note) values ('hdedm8@hc360.com',8,'aa');
insert  into email_info(email,num,note) values ('hdedm9@hc360.com',9,'aa');
insert  into email_info(email,num,note) values ('hdedm10@hc360.com',10,'aa');
insert  into email_info(email,num,note) values ('hdedm11@hc360.com',11,'aa');
insert  into email_info(email,num,note) values ('hdedm12@hc360.com',12,'aa');
insert  into email_info(email,num,note) values ('hdedm13@hc360.com',13,'aa');
insert  into email_info(email,num,note) values ('hdedm14@hc360.com',14,'aa');
insert  into email_info(email,num,note) values ('hdedm15@hc360.com',15,'aa');
insert  into email_info(email,num,note) values ('hdedm16@hc360.com',16,'aa');
insert  into email_info(email,num,note) values ('hdedm17@hc360.com',17,'aa');
insert  into email_info(email,num,note) values ('hdedm18@hc360.com',18,'aa');
insert  into email_info(email,num,note) values ('hdedm19@hc360.com',19,'aa');
insert  into email_info(email,num,note) values ('hdedm20@hc360.com',20,'aa');
insert  into email_info(email,num,note) values ('hdedm21@hc360.com',21,'aa');
insert  into email_info(email,num,note) values ('hdedm22@hc360.com',22,'aa');
insert  into email_info(email,num,note) values ('hdedm23@hc360.com',23,'aa');
insert  into email_info(email,num,note) values ('hdedm24@hc360.com',24,'aa');
insert  into email_info(email,num,note) values ('hdedm25@hc360.com',25,'aa');
insert  into email_info(email,num,note) values ('hdedm26@hc360.com',26,'aa');
insert  into email_info(email,num,note) values ('hdedm27@hc360.com',27,'aa');
insert  into email_info(email,num,note) values ('hdedm28@hc360.com',28,'aa');
insert  into email_info(email,num,note) values ('hdedm29@hc360.com',29,'aa');
insert  into email_info(email,num,note) values ('hdedm30@hc360.com',30,'aa');
insert  into email_info(email,num,note) values ('hdedm31@hc360.com',31,'aa');
insert  into email_info(email,num,note) values ('hdedm32@hc360.com',32,'aa');
insert  into email_info(email,num,note) values ('hdedm33@hc360.com',33,'aa');
insert  into email_info(email,num,note) values ('hdedm34@hc360.com',34,'aa');
insert  into email_info(email,num,note) values ('hdedm35@hc360.com',35,'aa');
insert  into email_info(email,num,note) values ('hdedm36@hc360.com',36,'aa');
insert  into email_info(email,num,note) values ('hdedm37@hc360.com',37,'aa');
insert  into email_info(email,num,note) values ('hdedm38@hc360.com',38,'aa');
insert  into email_info(email,num,note) values ('hdedm39@hc360.com',39,'aa');
insert  into email_info(email,num,note) values ('hdedm40@hc360.com',40,'aa');
insert  into email_info(email,num,note) values ('hdedm41@hc360.com',41,'aa');
insert  into email_info(email,num,note) values ('hdedm42@hc360.com',42,'aa');
insert  into email_info(email,num,note) values ('hdedm43@hc360.com',43,'aa');
insert  into email_info(email,num,note) values ('hdedm44@hc360.com',44,'aa');
insert  into email_info(email,num,note) values ('hdedm45@hc360.com',45,'aa');
insert  into email_info(email,num,note) values ('hdedm46@hc360.com',46,'aa');
insert  into email_info(email,num,note) values ('hdedm47@hc360.com',47,'aa');
insert  into email_info(email,num,note) values ('hdedm48@hc360.com',48,'aa');
insert  into email_info(email,num,note) values ('hdedm49@hc360.com',49,'aa');
insert  into email_info(email,num,note) values ('hdedm50@hc360.com',50,'aa');
insert  into email_info(email,num,note) values ('hdedm51@hc360.com',51,'aa');
insert  into email_info(email,num,note) values ('hdedm52@hc360.com',52,'aa');
insert  into email_info(email,num,note) values ('hdedm53@hc360.com',53,'aa');
insert  into email_info(email,num,note) values ('hdedm54@hc360.com',54,'aa');
insert  into email_info(email,num,note) values ('hdedm55@hc360.com',55,'aa');
insert  into email_info(email,num,note) values ('hdedm56@hc360.com',56,'aa');
insert  into email_info(email,num,note) values ('hdedm57@hc360.com',57,'aa');
insert  into email_info(email,num,note) values ('hdedm58@hc360.com',58,'aa');
insert  into email_info(email,num,note) values ('hdedm59@hc360.com',59,'aa');
insert  into email_info(email,num,note) values ('hdedm60@hc360.com',60,'aa');
insert  into email_info(email,num,note) values ('hdedm61@hc360.com',61,'aa');
insert  into email_info(email,num,note) values ('hdedm62@hc360.com',62,'aa');
insert  into email_info(email,num,note) values ('hdedm63@hc360.com',63,'aa');
insert  into email_info(email,num,note) values ('hdedm64@hc360.com',64,'aa');
insert  into email_info(email,num,note) values ('hdedm65@hc360.com',65,'aa');
insert  into email_info(email,num,note) values ('hdedm66@hc360.com',66,'aa');
insert  into email_info(email,num,note) values ('hdedm67@hc360.com',67,'aa');
insert  into email_info(email,num,note) values ('hdedm68@hc360.com',68,'aa');
insert  into email_info(email,num,note) values ('hdedm69@hc360.com',69,'aa');
insert  into email_info(email,num,note) values ('hdedm70@hc360.com',70,'aa');
insert  into email_info(email,num,note) values ('hdedm71@hc360.com',71,'aa');
insert  into email_info(email,num,note) values ('hdedm72@hc360.com',72,'aa');
insert  into email_info(email,num,note) values ('hdedm73@hc360.com',73,'aa');
insert  into email_info(email,num,note) values ('hdedm74@hc360.com',74,'aa');
insert  into email_info(email,num,note) values ('hdedm75@hc360.com',75,'aa');
insert  into email_info(email,num,note) values ('hdedm76@hc360.com',76,'aa');
insert  into email_info(email,num,note) values ('hdedm77@hc360.com',77,'aa');
insert  into email_info(email,num,note) values ('hdedm78@hc360.com',78,'aa');
insert  into email_info(email,num,note) values ('hdedm79@hc360.com',79,'aa');
insert  into email_info(email,num,note) values ('hdedm80@hc360.com',80,'aa');
insert  into email_info(email,num,note) values ('hdedm81@hc360.com',81,'aa');
insert  into email_info(email,num,note) values ('hdedm82@hc360.com',82,'aa');
insert  into email_info(email,num,note) values ('hdedm83@hc360.com',83,'aa');
insert  into email_info(email,num,note) values ('hdedm84@hc360.com',84,'aa');
insert  into email_info(email,num,note) values ('hdedm85@hc360.com',85,'aa');
insert  into email_info(email,num,note) values ('hdedm86@hc360.com',86,'aa');
insert  into email_info(email,num,note) values ('hdedm87@hc360.com',87,'aa');
insert  into email_info(email,num,note) values ('hdedm88@hc360.com',88,'aa');
insert  into email_info(email,num,note) values ('hdedm89@hc360.com',89,'aa');
insert  into email_info(email,num,note) values ('hdedm90@hc360.com',90,'aa');
insert  into email_info(email,num,note) values ('hdedm91@hc360.com',91,'aa');
insert  into email_info(email,num,note) values ('hdedm92@hc360.com',92,'aa');
insert  into email_info(email,num,note) values ('hdedm93@hc360.com',93,'aa');
insert  into email_info(email,num,note) values ('hdedm94@hc360.com',94,'aa');
insert  into email_info(email,num,note) values ('hdedm95@hc360.com',95,'aa');
insert  into email_info(email,num,note) values ('hdedm96@hc360.com',96,'aa');
insert  into email_info(email,num,note) values ('hdedm97@hc360.com',97,'aa');
insert  into email_info(email,num,note) values ('hdedm98@hc360.com',98,'aa');
insert  into email_info(email,num,note) values ('hdedm99@hc360.com',99,'aa');
/**====================在cobar server的schema(edm)的root账号下,对水平分区库email_info_detail写入100条数  据==============================**/
insert  into email_info_detail(email,num_a,num_b) values ('hdedm0@hc360.com',0,0);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm1@hc360.com',1,-1);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm2@hc360.com',2,-2);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm3@hc360.com',3,-3);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm4@hc360.com',4,-4);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm5@hc360.com',5,-5);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm6@hc360.com',6,-6);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm7@hc360.com',7,-7);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm8@hc360.com',8,-8);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm9@hc360.com',9,-9);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm10@hc360.com',10,-10);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm11@hc360.com',11,-11);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm12@hc360.com',12,-12);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm13@hc360.com',13,-13);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm14@hc360.com',14,-14);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm15@hc360.com',15,-15);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm16@hc360.com',16,-16);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm17@hc360.com',17,-17);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm18@hc360.com',18,-18);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm19@hc360.com',19,-19);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm20@hc360.com',20,-20);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm21@hc360.com',21,-21);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm22@hc360.com',22,-22);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm23@hc360.com',23,-23);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm24@hc360.com',24,-24);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm25@hc360.com',25,-25);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm26@hc360.com',26,-26);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm27@hc360.com',27,-27);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm28@hc360.com',28,-28);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm29@hc360.com',29,-29);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm30@hc360.com',30,-30);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm31@hc360.com',31,-31);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm32@hc360.com',32,-32);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm33@hc360.com',33,-33);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm34@hc360.com',34,-34);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm35@hc360.com',35,-35);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm36@hc360.com',36,-36);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm37@hc360.com',37,-37);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm38@hc360.com',38,-38);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm39@hc360.com',39,-39);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm40@hc360.com',40,-40);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm41@hc360.com',41,-41);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm42@hc360.com',42,-42);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm43@hc360.com',43,-43);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm44@hc360.com',44,-44);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm45@hc360.com',45,-45);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm46@hc360.com',46,-46);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm47@hc360.com',47,-47);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm48@hc360.com',48,-48);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm49@hc360.com',49,-49);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm50@hc360.com',50,-50);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm51@hc360.com',51,-51);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm52@hc360.com',52,-52);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm53@hc360.com',53,-53);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm54@hc360.com',54,-54);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm55@hc360.com',55,-55);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm56@hc360.com',56,-56);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm57@hc360.com',57,-57);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm58@hc360.com',58,-58);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm59@hc360.com',59,-59);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm60@hc360.com',60,-60);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm61@hc360.com',61,-61);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm62@hc360.com',62,-62);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm63@hc360.com',63,-63);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm64@hc360.com',64,-64);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm65@hc360.com',65,-65);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm66@hc360.com',66,-66);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm67@hc360.com',67,-67);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm68@hc360.com',68,-68);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm69@hc360.com',69,-69);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm70@hc360.com',70,-70);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm71@hc360.com',71,-71);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm72@hc360.com',72,-72);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm73@hc360.com',73,-73);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm74@hc360.com',74,-74);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm75@hc360.com',75,-75);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm76@hc360.com',76,-76);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm77@hc360.com',77,-77);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm78@hc360.com',78,-78);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm79@hc360.com',79,-79);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm80@hc360.com',80,-80);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm81@hc360.com',81,-81);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm82@hc360.com',82,-82);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm83@hc360.com',83,-83);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm84@hc360.com',84,-84);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm85@hc360.com',85,-85);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm86@hc360.com',86,-86);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm87@hc360.com',87,-87);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm88@hc360.com',88,-88);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm89@hc360.com',89,-89);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm90@hc360.com',90,-90);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm91@hc360.com',91,-91);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm92@hc360.com',92,-92);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm93@hc360.com',93,-93);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm94@hc360.com',94,-94);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm95@hc360.com',95,-95);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm96@hc360.com',96,-96);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm97@hc360.com',97,-97);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm98@hc360.com',98,-98);
insert  into email_info_detail(email,num_a,num_b) values ('hdedm99@hc360.com',99,-99);
/**======================在cobar server的schema(edm)的root账号下,直接修改水平分区表email_info数据============================**/
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm1@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm2@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm3@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm4@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm5@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm6@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm7@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm8@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm9@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm10@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm11@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm12@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm13@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm14@hc360.com';
update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm15@hc360.com';
/**=======================在cobar server的schema(edm)的root账号下,直接修改水平分区表email_info_detail数据===========================**/
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm1@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm2@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm3@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm4@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm5@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm6@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm7@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm8@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm9@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm10@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm11@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm12@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm13@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm14@hc360.com';
update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm15@hc360.com';
/**=====================创建演示分区数据库,注意不要放到一个数据库上=============================**/
create database if not exists `edmshard1`;
USE `edmshard1`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard2`;
USE `edmshard2`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard3`;
USE `edmshard3`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard4`;
USE `edmshard4`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard5`;
USE `edmshard5`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard6`;
USE `edmshard6`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard7`;
USE `edmshard7`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard8`;
USE `edmshard8`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard9`;
USE `edmshard9`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard10`;
USE `edmshard10`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard11`;
USE `edmshard11`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard12`;
USE `edmshard12`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard13`;
USE `edmshard13`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard14`;
USE `edmshard14`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard15`;
USE `edmshard15`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/
create database if not exists `edmshard16`;
USE `edmshard16`;
DROP TABLE IF EXISTS `email_info`;
CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `email_info_detail`;
CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
/**==================================================**/


5、生成测试sql的java类:GenShardSql.java  你可以自己生成测试数据以及测试库了

package com.gen.sql;
public class GenShardSql {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
//通过cobar进行数据展示
String a="use edm;";
System.out.println(a);
System.out.println("/**==================================================**/");
GenShardSql gss=new GenShardSql();
//清理主库以及分区库
gss.clearDate();
System.out.println("/**==================================================**/");
//给主库增加数据
gss.println_edm_hd(100);
System.out.println("/**==================================================**/");
//给分区库增加数据
gss.println_email_info(100);
System.out.println("/**==================================================**/");
gss.println_email_info_detail(100);
System.out.println("/**==================================================**/");
//修改数据
gss.modifyEmailData(1, 16, 88888);
//初始化分区库
gss.initdb(1, 16);
}
public void clearDate(){
//清理主库
String del="delete from edm_users;";
System.out.println(del);
//清理分区库
del="delete from email_info;";
System.out.println(del);
//清理分区库
del="delete from email_info_detail;";
System.out.println(del);
}
public void println_email_info(int num){
String a="";
for(int i=0;i<num;i++){
a="insert  into email_info(email,num,note) values (\'hdedm"+i+"@hc360.com\',"+i+",\'aa\');";
System.out.println(a);
}
}
public void println_email_info_detail(int num){
String b="";
for(int i=0;i<num;i++){
b="insert  into email_info_detail(email,num_a,num_b) values ('hdedm"+i+"@hc360.com',"+i+","+-i+");";
System.out.println(b);
}
}
public void println_edm_hd(int num){
String a="use edm;";
System.out.println(a);
String b="";
for(int i=0;i<num;i++){
b="insert into edm_users(name,email,password,grouptype,dateline) values (\'edm_hd"+i+"\',\'edm_hd"+i+"@hc360.com\',\'psw"+i+"\',\'1\',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));";
System.out.println(b);
}
}
/**初始化分区DB*/
public void initdb(int start,int end){
for(int i=start;i<=end;i++){
String create="create database if not exists `edmshard"+i+"`;";
String use="USE `edmshard"+i+"`;";
String drop1="DROP TABLE IF EXISTS `email_info`;";
String c_t1="CREATE TABLE `email_info` (  `email` varchar(300) CHARACTER SET utf8 DEFAULT NULL, `num` int(10) DEFAULT NULL,  `note` varchar(500) CHARACTER SET utf8 DEFAULT NULL,`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
String drop2="DROP TABLE IF EXISTS `email_info_detail`;";
String c_t2="CREATE TABLE `email_info_detail` (  `email` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL,  `num_a` int(10) DEFAULT 0,  `num_b` int(10) DEFAULT 0,  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
System.out.println(create);
System.out.println(use);
System.out.println(drop1);
System.out.println(c_t1);
System.out.println(drop2);
System.out.println(c_t2);
System.out.println("/**==================================================**/");
}
}
/**
* 根据邮箱更改某个分区的数据
* */
public void modifyEmailData(int start,int end,int val){
String ms="";
for(int i=start;i<end;i++){
ms="update email_info ei set ei.num="+val+", ei.create_time=now() where ei.email=\'hdedm"+i+"@hc360.com\';";
System.out.println(ms);
}
System.out.println("/**==================================================**/");
for(int i=start;i<end;i++){
ms="update email_info_detail eid set eid.num_a="+val+", eid.create_time=now() where eid.email=\'hdedm"+i+"@hc360.com\';";
System.out.println(ms);
}
System.out.println("/**==================================================**/");
} 
}


http://chatgpt.dhexx.cn/article/mntNd1en.shtml

相关文章

开源的分布式数据库中间件系统Mycat和阿里巴巴Cobar的对比

mycat 不得不说的缘分 原创 2016年04月15日 15:48:17 27834 1&#xff0c;愕然回首&#xff0c;它在灯火阑珊处 关于mysql集群中间件&#xff0c;以前写在应用程序里面&#xff0c;由开发人员实现&#xff0c;在配置文件里面写多个数据源&#xff0c;写库一个数据源&#xff0…

分布式数据中间件TDDL、Amoeba、Cobar、MyCAT架构比较

框架比较 TDDL Amoeba Cobar MyCat 点评 TDDL不同于其它几款产品&#xff0c;并非独立的中间件&#xff0c;只能算作中间层&#xff0c;是以Jar包方式提供给应用调用。属于JDBC Shard的思想&#xff0c;网上也有很多其它类似产品。 另外&#xff0c;网上有关于TDDL的图&#x…

TDDL、Amoeba、Cobar、MyCAT架构比较

布式数据库中间件TDDL、Amoeba、Cobar、MyCAT架构比较分 比较了业界流行的MySQL分布式数据库中间件&#xff0c;关于每个产品的介绍&#xff0c;网上的资料比较多&#xff0c;本文只是对几款产品的架构进行比较&#xff0c;从中可以看出中间件发展和演进路线 框架比较 TDDL Am…

Cobar使用文档(可用作MySQL大型集群解决方案)

转&#xff1a;http://blog.csdn.net/shagoo/article/details/8191346 最近好不容易抽空研究了下Cobar&#xff0c;感觉这个产品确实很不错&#xff08;在文档方面比Amoeba强多了&#xff09;&#xff0c;特此推荐给大家。Cobar是阿里巴巴研发的关系型数据的分布式处理系统&am…

Cobar的架构与实践

Cobar是提供分布式数据库服务的中间件&#xff0c;是阿里巴巴B2B前台应用访问数据库的统一入口。本文讲述的就是Cobar的架构演变与应用实践。 2008年&#xff0c;阿里巴巴B2B成立了平台技术部&#xff0c;为各个业务部门的产品提供底层的基础平台。这些平台涵盖Web框架、消息…

alibaba的COBAR真是强大.

最近好不容易抽空研究了下Cobar&#xff0c;感觉这个产品确实很不错&#xff08;在文档方面比Amoeba强多了&#xff09;&#xff0c;特此推荐给大家。Cobar是阿里巴巴研发的关系型数据的分布式处理系统&#xff0c;该产品成功替代了原先基于Oracle的数据存储方案&#xff0c;目…

Alibaba的COBAR真是强大

&#xfeff;&#xfeff; 最近好不容易抽空研究了下Cobar&#xff0c;感觉这个产品确实很不错&#xff08;在文档方面比Amoeba强多了&#xff09;&#xff0c;特此推荐给大家。Cobar是阿里巴巴研发的关系型数据的分布式处理系统&#xff0c;该产品成功替代了原先基于Oracle的…

Cobar Client的使用

cobar client是出自阿里的产品&#xff0c;cobar client只需要引入jar包即可&#xff0c;不需要建立服务。下面的地址是cobar client的帮助文档 http://code.alibabatech.com/docs/cobarclient/zh/ http://www.kuqin.com/system-analysis/20120212/318089.html 分库分表都…

Cobar介绍

概述 Cobar是关系型数据的分布式处理系统&#xff0c;它可以在分布式的环境下看上去像传统数据库一样为您提供海量数据服务。 产品在阿里巴巴B2B公司已经稳定运行了3年以上。目前已经接管了3000个MySQL数据库的schema&#xff0c;为应用提供数据服务。据最近统计cobar集群目前…

[存储] Cobar使用文档(可用作MySQL大型集群解决方案)

最近好不容易抽空研究了下Cobar&#xff0c;感觉这个产品确实很不错&#xff08;在文档方面比Amoeba强多了&#xff09;&#xff0c;特此推荐给大家。Cobar是阿里巴巴研发的关系型数据的分布式处理系统&#xff0c;该产品成功替代了原先基于Oracle的数据存储方案&#xff0c;目…

Linux nohup命令用法详解

nohup 英文全称 no hang up&#xff08;不挂起&#xff09;&#xff0c;用于在系统后台不挂断地运行命令&#xff0c;退出终端不会影响程序的运行。 nohup 命令&#xff0c;在默认情况下&#xff08;非重定向时&#xff09;&#xff0c;会输出一个名叫 nohup.out 的文件到当前…

Linux nohup 命令

1.简介 nohup 英文全称 no hang up&#xff08;不挂起&#xff09;&#xff0c;用于在系统后台不挂断地运行命令&#xff0c;退出终端不会影响程序的运行。 nohup 命令&#xff0c;在默认情况下&#xff08;非重定向时&#xff09;&#xff0c;会输出一个名叫 nohup.out 的文…

【nohup】nohup命令的简单使用

文章目录 1 nohup时2 nohup后 1 nohup时 执行下方命令后&#xff0c;将 标准输出(1&#xff0c;默认可不写)、错误信息(2) 写入到 output.log 文件中。 nohup python train.py >output.log 2>&1 & nohup hb_mapper makertbin -c xx.yaml --model-type onnx 2&g…

【学习笔记】Windows 下线程同步之互斥锁

目录 前言环境简介相关函数CreateMutexWait 函数ReleaseMutexCloseHandle 其他互斥锁的名字未命名互斥锁的同步互斥锁的意外终止临界区对象 示例参考 前言 本文所涉及的同步主要描述在 Windows 环境下的机制&#xff0c;和 Linux 中的同步机制有一定的联系&#xff0c;但注意并…

C++——互斥量

文章目录 一、基本知识二、独占互斥量mutex1.mutex的介绍2.mutex的成员函数3.实例演示 三、lock_guard和unique_lock的使用和区别四、递归互斥量recursive_mutex1.基本知识2.演示示例 五、带超时的互斥量std::timed_mutex和std::recursive_timed_mutex 一、基本知识 C11提供如…

Linux——什么是互斥与互斥锁

目录 一.前提&#xff1a;临界区 & 临界资源 二.什么是互斥 &#xff08;一&#xff09;.互斥概念 &#xff08;二&#xff09;.为什么需要互斥 三.互斥锁介绍 &#xff08;一&#xff09;.互斥锁的概念 &#xff08;二&#xff09;.互斥锁的使用 ①系统API接口 ②…

线程的互斥与同步

线程的互斥与同步 线程的互斥简单的抢票程序互斥量初始化互斥量销毁互斥量互斥量加锁和解锁 互斥量实现原理 可重入VS线程安全概念常见的线程不安全的情况常见的线程安全的情况常见不可重入的情况常见可重入的情况可重入与线程安全联系可重入与线程安全区别 死锁死锁四个必要条…

FreeRTOS个人笔记-互斥量

根据个人的学习方向&#xff0c;学习FreeRTOS。由于野火小哥把FreeRTOS讲得比较含蓄&#xff0c;打算在本专栏尽量细化一点。作为个人笔记&#xff0c;仅供参考或查阅。 配套资料&#xff1a;FreeRTOS内核实现与应用开发实战指南、野火FreeRTOS配套视频源码、b站野火FreeRTOS视…

C++ 互斥锁原理以及实际使用介绍

兄弟姐妹们&#xff0c;我又回来了&#xff0c;今天带来实际开发中都需要使用的互斥锁的内容&#xff0c;主要聊一聊如何使用互斥锁以及都有哪几种方式实现互斥锁。实现互斥&#xff0c;可以有以下几种方式&#xff1a;互斥量&#xff08;Mutex&#xff09;、递归互斥量&#x…

MySQL mutex互斥锁

在事务机制中&#xff0c;锁机制是为了保证高并发&#xff0c;数据一致性的重要实现方式。MySQL除了Innodb引擎层面的行锁&#xff0c;还有latch锁。latch锁的作用资源协调处理。包含表句柄&#xff0c;线程&#xff0c;cpu线程&#xff0c;内存池等。其保证非常短时间内快速处…