鞋垫

导航

 

一、需求

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

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


二、问题

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

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


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

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


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

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

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


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


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

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

 

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

 

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


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

  1. use edm;  
  2. /**=====================在cobar server的schema(edm)的root账号下,直接清理数据=============================**/  
  3. delete from edm_users;  
  4. delete from email_info;  
  5. delete from email_info_detail;  
  6. /**======================在cobar server的schema(edm)的root账号下,直接写入非分区库edm_hd中的edm_users 100条数据============================**/  
  7. use edm;  
  8. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd0','edm_hd0@hc360.com','psw0','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  9. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd1','edm_hd1@hc360.com','psw1','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  10. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd2','edm_hd2@hc360.com','psw2','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  11. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd3','edm_hd3@hc360.com','psw3','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  12. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd4','edm_hd4@hc360.com','psw4','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  13. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd5','edm_hd5@hc360.com','psw5','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  14. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd6','edm_hd6@hc360.com','psw6','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  15. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd7','edm_hd7@hc360.com','psw7','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  16. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd8','edm_hd8@hc360.com','psw8','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  17. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd9','edm_hd9@hc360.com','psw9','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  18. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd10','edm_hd10@hc360.com','psw10','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  19. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd11','edm_hd11@hc360.com','psw11','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  20. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd12','edm_hd12@hc360.com','psw12','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  21. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd13','edm_hd13@hc360.com','psw13','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  22. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd14','edm_hd14@hc360.com','psw14','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  23. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd15','edm_hd15@hc360.com','psw15','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  24. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd16','edm_hd16@hc360.com','psw16','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  25. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd17','edm_hd17@hc360.com','psw17','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  26. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd18','edm_hd18@hc360.com','psw18','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  27. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd19','edm_hd19@hc360.com','psw19','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  28. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd20','edm_hd20@hc360.com','psw20','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  29. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd21','edm_hd21@hc360.com','psw21','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  30. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd22','edm_hd22@hc360.com','psw22','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  31. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd23','edm_hd23@hc360.com','psw23','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  32. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd24','edm_hd24@hc360.com','psw24','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  33. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd25','edm_hd25@hc360.com','psw25','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  34. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd26','edm_hd26@hc360.com','psw26','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  35. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd27','edm_hd27@hc360.com','psw27','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  36. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd28','edm_hd28@hc360.com','psw28','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  37. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd29','edm_hd29@hc360.com','psw29','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  38. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd30','edm_hd30@hc360.com','psw30','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  39. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd31','edm_hd31@hc360.com','psw31','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  40. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd32','edm_hd32@hc360.com','psw32','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  41. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd33','edm_hd33@hc360.com','psw33','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  42. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd34','edm_hd34@hc360.com','psw34','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  43. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd35','edm_hd35@hc360.com','psw35','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  44. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd36','edm_hd36@hc360.com','psw36','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  45. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd37','edm_hd37@hc360.com','psw37','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  46. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd38','edm_hd38@hc360.com','psw38','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  47. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd39','edm_hd39@hc360.com','psw39','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  48. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd40','edm_hd40@hc360.com','psw40','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  49. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd41','edm_hd41@hc360.com','psw41','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  50. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd42','edm_hd42@hc360.com','psw42','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  51. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd43','edm_hd43@hc360.com','psw43','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  52. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd44','edm_hd44@hc360.com','psw44','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  53. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd45','edm_hd45@hc360.com','psw45','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  54. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd46','edm_hd46@hc360.com','psw46','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  55. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd47','edm_hd47@hc360.com','psw47','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  56. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd48','edm_hd48@hc360.com','psw48','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  57. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd49','edm_hd49@hc360.com','psw49','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  58. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd50','edm_hd50@hc360.com','psw50','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  59. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd51','edm_hd51@hc360.com','psw51','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  60. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd52','edm_hd52@hc360.com','psw52','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  61. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd53','edm_hd53@hc360.com','psw53','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  62. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd54','edm_hd54@hc360.com','psw54','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  63. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd55','edm_hd55@hc360.com','psw55','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  64. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd56','edm_hd56@hc360.com','psw56','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  65. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd57','edm_hd57@hc360.com','psw57','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  66. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd58','edm_hd58@hc360.com','psw58','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  67. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd59','edm_hd59@hc360.com','psw59','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  68. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd60','edm_hd60@hc360.com','psw60','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  69. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd61','edm_hd61@hc360.com','psw61','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  70. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd62','edm_hd62@hc360.com','psw62','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  71. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd63','edm_hd63@hc360.com','psw63','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  72. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd64','edm_hd64@hc360.com','psw64','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  73. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd65','edm_hd65@hc360.com','psw65','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  74. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd66','edm_hd66@hc360.com','psw66','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  75. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd67','edm_hd67@hc360.com','psw67','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  76. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd68','edm_hd68@hc360.com','psw68','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  77. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd69','edm_hd69@hc360.com','psw69','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  78. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd70','edm_hd70@hc360.com','psw70','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  79. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd71','edm_hd71@hc360.com','psw71','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  80. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd72','edm_hd72@hc360.com','psw72','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  81. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd73','edm_hd73@hc360.com','psw73','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  82. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd74','edm_hd74@hc360.com','psw74','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  83. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd75','edm_hd75@hc360.com','psw75','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  84. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd76','edm_hd76@hc360.com','psw76','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  85. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd77','edm_hd77@hc360.com','psw77','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  86. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd78','edm_hd78@hc360.com','psw78','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  87. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd79','edm_hd79@hc360.com','psw79','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  88. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd80','edm_hd80@hc360.com','psw80','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  89. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd81','edm_hd81@hc360.com','psw81','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  90. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd82','edm_hd82@hc360.com','psw82','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  91. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd83','edm_hd83@hc360.com','psw83','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  92. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd84','edm_hd84@hc360.com','psw84','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  93. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd85','edm_hd85@hc360.com','psw85','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  94. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd86','edm_hd86@hc360.com','psw86','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  95. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd87','edm_hd87@hc360.com','psw87','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  96. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd88','edm_hd88@hc360.com','psw88','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  97. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd89','edm_hd89@hc360.com','psw89','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  98. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd90','edm_hd90@hc360.com','psw90','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  99. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd91','edm_hd91@hc360.com','psw91','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  100. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd92','edm_hd92@hc360.com','psw92','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  101. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd93','edm_hd93@hc360.com','psw93','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  102. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd94','edm_hd94@hc360.com','psw94','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  103. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd95','edm_hd95@hc360.com','psw95','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  104. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd96','edm_hd96@hc360.com','psw96','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  105. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd97','edm_hd97@hc360.com','psw97','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  106. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd98','edm_hd98@hc360.com','psw98','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  107. insert into edm_users(name,email,password,grouptype,dateline) values ('edm_hd99','edm_hd99@hc360.com','psw99','1',UNIX_TIMESTAMP(CURRENT_TIMESTAMP));  
  108.   
  109. /**=====================在cobar server的schema(edm)的root账号下,向水平分区的email_info写入100条数据=============================**/  
  110. insert  into email_info(email,num,note) values ('hdedm0@hc360.com',0,'aa');  
  111. insert  into email_info(email,num,note) values ('hdedm1@hc360.com',1,'aa');  
  112. insert  into email_info(email,num,note) values ('hdedm2@hc360.com',2,'aa');  
  113. insert  into email_info(email,num,note) values ('hdedm3@hc360.com',3,'aa');  
  114. insert  into email_info(email,num,note) values ('hdedm4@hc360.com',4,'aa');  
  115. insert  into email_info(email,num,note) values ('hdedm5@hc360.com',5,'aa');  
  116. insert  into email_info(email,num,note) values ('hdedm6@hc360.com',6,'aa');  
  117. insert  into email_info(email,num,note) values ('hdedm7@hc360.com',7,'aa');  
  118. insert  into email_info(email,num,note) values ('hdedm8@hc360.com',8,'aa');  
  119. insert  into email_info(email,num,note) values ('hdedm9@hc360.com',9,'aa');  
  120. insert  into email_info(email,num,note) values ('hdedm10@hc360.com',10,'aa');  
  121. insert  into email_info(email,num,note) values ('hdedm11@hc360.com',11,'aa');  
  122. insert  into email_info(email,num,note) values ('hdedm12@hc360.com',12,'aa');  
  123. insert  into email_info(email,num,note) values ('hdedm13@hc360.com',13,'aa');  
  124. insert  into email_info(email,num,note) values ('hdedm14@hc360.com',14,'aa');  
  125. insert  into email_info(email,num,note) values ('hdedm15@hc360.com',15,'aa');  
  126. insert  into email_info(email,num,note) values ('hdedm16@hc360.com',16,'aa');  
  127. insert  into email_info(email,num,note) values ('hdedm17@hc360.com',17,'aa');  
  128. insert  into email_info(email,num,note) values ('hdedm18@hc360.com',18,'aa');  
  129. insert  into email_info(email,num,note) values ('hdedm19@hc360.com',19,'aa');  
  130. insert  into email_info(email,num,note) values ('hdedm20@hc360.com',20,'aa');  
  131. insert  into email_info(email,num,note) values ('hdedm21@hc360.com',21,'aa');  
  132. insert  into email_info(email,num,note) values ('hdedm22@hc360.com',22,'aa');  
  133. insert  into email_info(email,num,note) values ('hdedm23@hc360.com',23,'aa');  
  134. insert  into email_info(email,num,note) values ('hdedm24@hc360.com',24,'aa');  
  135. insert  into email_info(email,num,note) values ('hdedm25@hc360.com',25,'aa');  
  136. insert  into email_info(email,num,note) values ('hdedm26@hc360.com',26,'aa');  
  137. insert  into email_info(email,num,note) values ('hdedm27@hc360.com',27,'aa');  
  138. insert  into email_info(email,num,note) values ('hdedm28@hc360.com',28,'aa');  
  139. insert  into email_info(email,num,note) values ('hdedm29@hc360.com',29,'aa');  
  140. insert  into email_info(email,num,note) values ('hdedm30@hc360.com',30,'aa');  
  141. insert  into email_info(email,num,note) values ('hdedm31@hc360.com',31,'aa');  
  142. insert  into email_info(email,num,note) values ('hdedm32@hc360.com',32,'aa');  
  143. insert  into email_info(email,num,note) values ('hdedm33@hc360.com',33,'aa');  
  144. insert  into email_info(email,num,note) values ('hdedm34@hc360.com',34,'aa');  
  145. insert  into email_info(email,num,note) values ('hdedm35@hc360.com',35,'aa');  
  146. insert  into email_info(email,num,note) values ('hdedm36@hc360.com',36,'aa');  
  147. insert  into email_info(email,num,note) values ('hdedm37@hc360.com',37,'aa');  
  148. insert  into email_info(email,num,note) values ('hdedm38@hc360.com',38,'aa');  
  149. insert  into email_info(email,num,note) values ('hdedm39@hc360.com',39,'aa');  
  150. insert  into email_info(email,num,note) values ('hdedm40@hc360.com',40,'aa');  
  151. insert  into email_info(email,num,note) values ('hdedm41@hc360.com',41,'aa');  
  152. insert  into email_info(email,num,note) values ('hdedm42@hc360.com',42,'aa');  
  153. insert  into email_info(email,num,note) values ('hdedm43@hc360.com',43,'aa');  
  154. insert  into email_info(email,num,note) values ('hdedm44@hc360.com',44,'aa');  
  155. insert  into email_info(email,num,note) values ('hdedm45@hc360.com',45,'aa');  
  156. insert  into email_info(email,num,note) values ('hdedm46@hc360.com',46,'aa');  
  157. insert  into email_info(email,num,note) values ('hdedm47@hc360.com',47,'aa');  
  158. insert  into email_info(email,num,note) values ('hdedm48@hc360.com',48,'aa');  
  159. insert  into email_info(email,num,note) values ('hdedm49@hc360.com',49,'aa');  
  160. insert  into email_info(email,num,note) values ('hdedm50@hc360.com',50,'aa');  
  161. insert  into email_info(email,num,note) values ('hdedm51@hc360.com',51,'aa');  
  162. insert  into email_info(email,num,note) values ('hdedm52@hc360.com',52,'aa');  
  163. insert  into email_info(email,num,note) values ('hdedm53@hc360.com',53,'aa');  
  164. insert  into email_info(email,num,note) values ('hdedm54@hc360.com',54,'aa');  
  165. insert  into email_info(email,num,note) values ('hdedm55@hc360.com',55,'aa');  
  166. insert  into email_info(email,num,note) values ('hdedm56@hc360.com',56,'aa');  
  167. insert  into email_info(email,num,note) values ('hdedm57@hc360.com',57,'aa');  
  168. insert  into email_info(email,num,note) values ('hdedm58@hc360.com',58,'aa');  
  169. insert  into email_info(email,num,note) values ('hdedm59@hc360.com',59,'aa');  
  170. insert  into email_info(email,num,note) values ('hdedm60@hc360.com',60,'aa');  
  171. insert  into email_info(email,num,note) values ('hdedm61@hc360.com',61,'aa');  
  172. insert  into email_info(email,num,note) values ('hdedm62@hc360.com',62,'aa');  
  173. insert  into email_info(email,num,note) values ('hdedm63@hc360.com',63,'aa');  
  174. insert  into email_info(email,num,note) values ('hdedm64@hc360.com',64,'aa');  
  175. insert  into email_info(email,num,note) values ('hdedm65@hc360.com',65,'aa');  
  176. insert  into email_info(email,num,note) values ('hdedm66@hc360.com',66,'aa');  
  177. insert  into email_info(email,num,note) values ('hdedm67@hc360.com',67,'aa');  
  178. insert  into email_info(email,num,note) values ('hdedm68@hc360.com',68,'aa');  
  179. insert  into email_info(email,num,note) values ('hdedm69@hc360.com',69,'aa');  
  180. insert  into email_info(email,num,note) values ('hdedm70@hc360.com',70,'aa');  
  181. insert  into email_info(email,num,note) values ('hdedm71@hc360.com',71,'aa');  
  182. insert  into email_info(email,num,note) values ('hdedm72@hc360.com',72,'aa');  
  183. insert  into email_info(email,num,note) values ('hdedm73@hc360.com',73,'aa');  
  184. insert  into email_info(email,num,note) values ('hdedm74@hc360.com',74,'aa');  
  185. insert  into email_info(email,num,note) values ('hdedm75@hc360.com',75,'aa');  
  186. insert  into email_info(email,num,note) values ('hdedm76@hc360.com',76,'aa');  
  187. insert  into email_info(email,num,note) values ('hdedm77@hc360.com',77,'aa');  
  188. insert  into email_info(email,num,note) values ('hdedm78@hc360.com',78,'aa');  
  189. insert  into email_info(email,num,note) values ('hdedm79@hc360.com',79,'aa');  
  190. insert  into email_info(email,num,note) values ('hdedm80@hc360.com',80,'aa');  
  191. insert  into email_info(email,num,note) values ('hdedm81@hc360.com',81,'aa');  
  192. insert  into email_info(email,num,note) values ('hdedm82@hc360.com',82,'aa');  
  193. insert  into email_info(email,num,note) values ('hdedm83@hc360.com',83,'aa');  
  194. insert  into email_info(email,num,note) values ('hdedm84@hc360.com',84,'aa');  
  195. insert  into email_info(email,num,note) values ('hdedm85@hc360.com',85,'aa');  
  196. insert  into email_info(email,num,note) values ('hdedm86@hc360.com',86,'aa');  
  197. insert  into email_info(email,num,note) values ('hdedm87@hc360.com',87,'aa');  
  198. insert  into email_info(email,num,note) values ('hdedm88@hc360.com',88,'aa');  
  199. insert  into email_info(email,num,note) values ('hdedm89@hc360.com',89,'aa');  
  200. insert  into email_info(email,num,note) values ('hdedm90@hc360.com',90,'aa');  
  201. insert  into email_info(email,num,note) values ('hdedm91@hc360.com',91,'aa');  
  202. insert  into email_info(email,num,note) values ('hdedm92@hc360.com',92,'aa');  
  203. insert  into email_info(email,num,note) values ('hdedm93@hc360.com',93,'aa');  
  204. insert  into email_info(email,num,note) values ('hdedm94@hc360.com',94,'aa');  
  205. insert  into email_info(email,num,note) values ('hdedm95@hc360.com',95,'aa');  
  206. insert  into email_info(email,num,note) values ('hdedm96@hc360.com',96,'aa');  
  207. insert  into email_info(email,num,note) values ('hdedm97@hc360.com',97,'aa');  
  208. insert  into email_info(email,num,note) values ('hdedm98@hc360.com',98,'aa');  
  209. insert  into email_info(email,num,note) values ('hdedm99@hc360.com',99,'aa');  
  210.   
  211. /**====================在cobar server的schema(edm)的root账号下,对水平分区库email_info_detail写入100条数  据==============================**/  
  212. insert  into email_info_detail(email,num_a,num_b) values ('hdedm0@hc360.com',0,0);  
  213. insert  into email_info_detail(email,num_a,num_b) values ('hdedm1@hc360.com',1,-1);  
  214. insert  into email_info_detail(email,num_a,num_b) values ('hdedm2@hc360.com',2,-2);  
  215. insert  into email_info_detail(email,num_a,num_b) values ('hdedm3@hc360.com',3,-3);  
  216. insert  into email_info_detail(email,num_a,num_b) values ('hdedm4@hc360.com',4,-4);  
  217. insert  into email_info_detail(email,num_a,num_b) values ('hdedm5@hc360.com',5,-5);  
  218. insert  into email_info_detail(email,num_a,num_b) values ('hdedm6@hc360.com',6,-6);  
  219. insert  into email_info_detail(email,num_a,num_b) values ('hdedm7@hc360.com',7,-7);  
  220. insert  into email_info_detail(email,num_a,num_b) values ('hdedm8@hc360.com',8,-8);  
  221. insert  into email_info_detail(email,num_a,num_b) values ('hdedm9@hc360.com',9,-9);  
  222. insert  into email_info_detail(email,num_a,num_b) values ('hdedm10@hc360.com',10,-10);  
  223. insert  into email_info_detail(email,num_a,num_b) values ('hdedm11@hc360.com',11,-11);  
  224. insert  into email_info_detail(email,num_a,num_b) values ('hdedm12@hc360.com',12,-12);  
  225. insert  into email_info_detail(email,num_a,num_b) values ('hdedm13@hc360.com',13,-13);  
  226. insert  into email_info_detail(email,num_a,num_b) values ('hdedm14@hc360.com',14,-14);  
  227. insert  into email_info_detail(email,num_a,num_b) values ('hdedm15@hc360.com',15,-15);  
  228. insert  into email_info_detail(email,num_a,num_b) values ('hdedm16@hc360.com',16,-16);  
  229. insert  into email_info_detail(email,num_a,num_b) values ('hdedm17@hc360.com',17,-17);  
  230. insert  into email_info_detail(email,num_a,num_b) values ('hdedm18@hc360.com',18,-18);  
  231. insert  into email_info_detail(email,num_a,num_b) values ('hdedm19@hc360.com',19,-19);  
  232. insert  into email_info_detail(email,num_a,num_b) values ('hdedm20@hc360.com',20,-20);  
  233. insert  into email_info_detail(email,num_a,num_b) values ('hdedm21@hc360.com',21,-21);  
  234. insert  into email_info_detail(email,num_a,num_b) values ('hdedm22@hc360.com',22,-22);  
  235. insert  into email_info_detail(email,num_a,num_b) values ('hdedm23@hc360.com',23,-23);  
  236. insert  into email_info_detail(email,num_a,num_b) values ('hdedm24@hc360.com',24,-24);  
  237. insert  into email_info_detail(email,num_a,num_b) values ('hdedm25@hc360.com',25,-25);  
  238. insert  into email_info_detail(email,num_a,num_b) values ('hdedm26@hc360.com',26,-26);  
  239. insert  into email_info_detail(email,num_a,num_b) values ('hdedm27@hc360.com',27,-27);  
  240. insert  into email_info_detail(email,num_a,num_b) values ('hdedm28@hc360.com',28,-28);  
  241. insert  into email_info_detail(email,num_a,num_b) values ('hdedm29@hc360.com',29,-29);  
  242. insert  into email_info_detail(email,num_a,num_b) values ('hdedm30@hc360.com',30,-30);  
  243. insert  into email_info_detail(email,num_a,num_b) values ('hdedm31@hc360.com',31,-31);  
  244. insert  into email_info_detail(email,num_a,num_b) values ('hdedm32@hc360.com',32,-32);  
  245. insert  into email_info_detail(email,num_a,num_b) values ('hdedm33@hc360.com',33,-33);  
  246. insert  into email_info_detail(email,num_a,num_b) values ('hdedm34@hc360.com',34,-34);  
  247. insert  into email_info_detail(email,num_a,num_b) values ('hdedm35@hc360.com',35,-35);  
  248. insert  into email_info_detail(email,num_a,num_b) values ('hdedm36@hc360.com',36,-36);  
  249. insert  into email_info_detail(email,num_a,num_b) values ('hdedm37@hc360.com',37,-37);  
  250. insert  into email_info_detail(email,num_a,num_b) values ('hdedm38@hc360.com',38,-38);  
  251. insert  into email_info_detail(email,num_a,num_b) values ('hdedm39@hc360.com',39,-39);  
  252. insert  into email_info_detail(email,num_a,num_b) values ('hdedm40@hc360.com',40,-40);  
  253. insert  into email_info_detail(email,num_a,num_b) values ('hdedm41@hc360.com',41,-41);  
  254. insert  into email_info_detail(email,num_a,num_b) values ('hdedm42@hc360.com',42,-42);  
  255. insert  into email_info_detail(email,num_a,num_b) values ('hdedm43@hc360.com',43,-43);  
  256. insert  into email_info_detail(email,num_a,num_b) values ('hdedm44@hc360.com',44,-44);  
  257. insert  into email_info_detail(email,num_a,num_b) values ('hdedm45@hc360.com',45,-45);  
  258. insert  into email_info_detail(email,num_a,num_b) values ('hdedm46@hc360.com',46,-46);  
  259. insert  into email_info_detail(email,num_a,num_b) values ('hdedm47@hc360.com',47,-47);  
  260. insert  into email_info_detail(email,num_a,num_b) values ('hdedm48@hc360.com',48,-48);  
  261. insert  into email_info_detail(email,num_a,num_b) values ('hdedm49@hc360.com',49,-49);  
  262. insert  into email_info_detail(email,num_a,num_b) values ('hdedm50@hc360.com',50,-50);  
  263. insert  into email_info_detail(email,num_a,num_b) values ('hdedm51@hc360.com',51,-51);  
  264. insert  into email_info_detail(email,num_a,num_b) values ('hdedm52@hc360.com',52,-52);  
  265. insert  into email_info_detail(email,num_a,num_b) values ('hdedm53@hc360.com',53,-53);  
  266. insert  into email_info_detail(email,num_a,num_b) values ('hdedm54@hc360.com',54,-54);  
  267. insert  into email_info_detail(email,num_a,num_b) values ('hdedm55@hc360.com',55,-55);  
  268. insert  into email_info_detail(email,num_a,num_b) values ('hdedm56@hc360.com',56,-56);  
  269. insert  into email_info_detail(email,num_a,num_b) values ('hdedm57@hc360.com',57,-57);  
  270. insert  into email_info_detail(email,num_a,num_b) values ('hdedm58@hc360.com',58,-58);  
  271. insert  into email_info_detail(email,num_a,num_b) values ('hdedm59@hc360.com',59,-59);  
  272. insert  into email_info_detail(email,num_a,num_b) values ('hdedm60@hc360.com',60,-60);  
  273. insert  into email_info_detail(email,num_a,num_b) values ('hdedm61@hc360.com',61,-61);  
  274. insert  into email_info_detail(email,num_a,num_b) values ('hdedm62@hc360.com',62,-62);  
  275. insert  into email_info_detail(email,num_a,num_b) values ('hdedm63@hc360.com',63,-63);  
  276. insert  into email_info_detail(email,num_a,num_b) values ('hdedm64@hc360.com',64,-64);  
  277. insert  into email_info_detail(email,num_a,num_b) values ('hdedm65@hc360.com',65,-65);  
  278. insert  into email_info_detail(email,num_a,num_b) values ('hdedm66@hc360.com',66,-66);  
  279. insert  into email_info_detail(email,num_a,num_b) values ('hdedm67@hc360.com',67,-67);  
  280. insert  into email_info_detail(email,num_a,num_b) values ('hdedm68@hc360.com',68,-68);  
  281. insert  into email_info_detail(email,num_a,num_b) values ('hdedm69@hc360.com',69,-69);  
  282. insert  into email_info_detail(email,num_a,num_b) values ('hdedm70@hc360.com',70,-70);  
  283. insert  into email_info_detail(email,num_a,num_b) values ('hdedm71@hc360.com',71,-71);  
  284. insert  into email_info_detail(email,num_a,num_b) values ('hdedm72@hc360.com',72,-72);  
  285. insert  into email_info_detail(email,num_a,num_b) values ('hdedm73@hc360.com',73,-73);  
  286. insert  into email_info_detail(email,num_a,num_b) values ('hdedm74@hc360.com',74,-74);  
  287. insert  into email_info_detail(email,num_a,num_b) values ('hdedm75@hc360.com',75,-75);  
  288. insert  into email_info_detail(email,num_a,num_b) values ('hdedm76@hc360.com',76,-76);  
  289. insert  into email_info_detail(email,num_a,num_b) values ('hdedm77@hc360.com',77,-77);  
  290. insert  into email_info_detail(email,num_a,num_b) values ('hdedm78@hc360.com',78,-78);  
  291. insert  into email_info_detail(email,num_a,num_b) values ('hdedm79@hc360.com',79,-79);  
  292. insert  into email_info_detail(email,num_a,num_b) values ('hdedm80@hc360.com',80,-80);  
  293. insert  into email_info_detail(email,num_a,num_b) values ('hdedm81@hc360.com',81,-81);  
  294. insert  into email_info_detail(email,num_a,num_b) values ('hdedm82@hc360.com',82,-82);  
  295. insert  into email_info_detail(email,num_a,num_b) values ('hdedm83@hc360.com',83,-83);  
  296. insert  into email_info_detail(email,num_a,num_b) values ('hdedm84@hc360.com',84,-84);  
  297. insert  into email_info_detail(email,num_a,num_b) values ('hdedm85@hc360.com',85,-85);  
  298. insert  into email_info_detail(email,num_a,num_b) values ('hdedm86@hc360.com',86,-86);  
  299. insert  into email_info_detail(email,num_a,num_b) values ('hdedm87@hc360.com',87,-87);  
  300. insert  into email_info_detail(email,num_a,num_b) values ('hdedm88@hc360.com',88,-88);  
  301. insert  into email_info_detail(email,num_a,num_b) values ('hdedm89@hc360.com',89,-89);  
  302. insert  into email_info_detail(email,num_a,num_b) values ('hdedm90@hc360.com',90,-90);  
  303. insert  into email_info_detail(email,num_a,num_b) values ('hdedm91@hc360.com',91,-91);  
  304. insert  into email_info_detail(email,num_a,num_b) values ('hdedm92@hc360.com',92,-92);  
  305. insert  into email_info_detail(email,num_a,num_b) values ('hdedm93@hc360.com',93,-93);  
  306. insert  into email_info_detail(email,num_a,num_b) values ('hdedm94@hc360.com',94,-94);  
  307. insert  into email_info_detail(email,num_a,num_b) values ('hdedm95@hc360.com',95,-95);  
  308. insert  into email_info_detail(email,num_a,num_b) values ('hdedm96@hc360.com',96,-96);  
  309. insert  into email_info_detail(email,num_a,num_b) values ('hdedm97@hc360.com',97,-97);  
  310. insert  into email_info_detail(email,num_a,num_b) values ('hdedm98@hc360.com',98,-98);  
  311. insert  into email_info_detail(email,num_a,num_b) values ('hdedm99@hc360.com',99,-99);  
  312.   
  313.   
  314. /**======================在cobar server的schema(edm)的root账号下,直接修改水平分区表email_info数据============================**/  
  315. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm1@hc360.com';  
  316. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm2@hc360.com';  
  317. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm3@hc360.com';  
  318. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm4@hc360.com';  
  319. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm5@hc360.com';  
  320. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm6@hc360.com';  
  321. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm7@hc360.com';  
  322. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm8@hc360.com';  
  323. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm9@hc360.com';  
  324. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm10@hc360.com';  
  325. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm11@hc360.com';  
  326. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm12@hc360.com';  
  327. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm13@hc360.com';  
  328. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm14@hc360.com';  
  329. update email_info ei set ei.num=88888, ei.create_time=now() where ei.email='hdedm15@hc360.com';  
  330.   
  331. /**=======================在cobar server的schema(edm)的root账号下,直接修改水平分区表email_info_detail数据===========================**/  
  332. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm1@hc360.com';  
  333. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm2@hc360.com';  
  334. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm3@hc360.com';  
  335. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm4@hc360.com';  
  336. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm5@hc360.com';  
  337. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm6@hc360.com';  
  338. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm7@hc360.com';  
  339. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm8@hc360.com';  
  340. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm9@hc360.com';  
  341. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm10@hc360.com';  
  342. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm11@hc360.com';  
  343. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm12@hc360.com';  
  344. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm13@hc360.com';  
  345. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm14@hc360.com';  
  346. update email_info_detail eid set eid.num_a=88888, eid.create_time=now() where eid.email='hdedm15@hc360.com';  
  347.   
  348.   
  349. /**=====================创建演示分区数据库,注意不要放到一个数据库上=============================**/  
  350. create database if not exists `edmshard1`;  
  351. USE `edmshard1`;  
  352. DROP TABLE IF EXISTS `email_info`;  
  353. 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;  
  354. DROP TABLE IF EXISTS `email_info_detail`;  
  355. 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;  
  356. /**==================================================**/  
  357. create database if not exists `edmshard2`;  
  358. USE `edmshard2`;  
  359. DROP TABLE IF EXISTS `email_info`;  
  360. 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;  
  361. DROP TABLE IF EXISTS `email_info_detail`;  
  362. 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;  
  363. /**==================================================**/  
  364. create database if not exists `edmshard3`;  
  365. USE `edmshard3`;  
  366. DROP TABLE IF EXISTS `email_info`;  
  367. 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;  
  368. DROP TABLE IF EXISTS `email_info_detail`;  
  369. 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;  
  370. /**==================================================**/  
  371. create database if not exists `edmshard4`;  
  372. USE `edmshard4`;  
  373. DROP TABLE IF EXISTS `email_info`;  
  374. 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;  
  375. DROP TABLE IF EXISTS `email_info_detail`;  
  376. 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;  
  377. /**==================================================**/  
  378. create database if not exists `edmshard5`;  
  379. USE `edmshard5`;  
  380. DROP TABLE IF EXISTS `email_info`;  
  381. 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;  
  382. DROP TABLE IF EXISTS `email_info_detail`;  
  383. 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;  
  384. /**==================================================**/  
  385. create database if not exists `edmshard6`;  
  386. USE `edmshard6`;  
  387. DROP TABLE IF EXISTS `email_info`;  
  388. 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;  
  389. DROP TABLE IF EXISTS `email_info_detail`;  
  390. 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;  
  391. /**==================================================**/  
  392. create database if not exists `edmshard7`;  
  393. USE `edmshard7`;  
  394. DROP TABLE IF EXISTS `email_info`;  
  395. 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;  
  396. DROP TABLE IF EXISTS `email_info_detail`;  
  397. 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;  
  398. /**==================================================**/  
  399. create database if not exists `edmshard8`;  
  400. USE `edmshard8`;  
  401. DROP TABLE IF EXISTS `email_info`;  
  402. 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;  
  403. DROP TABLE IF EXISTS `email_info_detail`;  
  404. 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;  
  405. /**==================================================**/  
  406. create database if not exists `edmshard9`;  
  407. USE `edmshard9`;  
  408. DROP TABLE IF EXISTS `email_info`;  
  409. 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;  
  410. DROP TABLE IF EXISTS `email_info_detail`;  
  411. 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;  
  412. /**==================================================**/  
  413. create database if not exists `edmshard10`;  
  414. USE `edmshard10`;  
  415. DROP TABLE IF EXISTS `email_info`;  
  416. 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;  
  417. DROP TABLE IF EXISTS `email_info_detail`;  
  418. 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;  
  419. /**==================================================**/  
  420. create database if not exists `edmshard11`;  
  421. USE `edmshard11`;  
  422. DROP TABLE IF EXISTS `email_info`;  
  423. 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;  
  424. DROP TABLE IF EXISTS `email_info_detail`;  
  425. 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;  
  426. /**==================================================**/  
  427. create database if not exists `edmshard12`;  
  428. USE `edmshard12`;  
  429. DROP TABLE IF EXISTS `email_info`;  
  430. 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;  
  431. DROP TABLE IF EXISTS `email_info_detail`;  
  432. 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;  
  433. /**==================================================**/  
  434. create database if not exists `edmshard13`;  
  435. USE `edmshard13`;  
  436. DROP TABLE IF EXISTS `email_info`;  
  437. 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;  
  438. DROP TABLE IF EXISTS `email_info_detail`;  
  439. 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;  
  440. /**==================================================**/  
  441. create database if not exists `edmshard14`;  
  442. USE `edmshard14`;  
  443. DROP TABLE IF EXISTS `email_info`;  
  444. 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;  
  445. DROP TABLE IF EXISTS `email_info_detail`;  
  446. 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;  
  447. /**==================================================**/  
  448. create database if not exists `edmshard15`;  
  449. USE `edmshard15`;  
  450. DROP TABLE IF EXISTS `email_info`;  
  451. 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;  
  452. DROP TABLE IF EXISTS `email_info_detail`;  
  453. 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;  
  454. /**==================================================**/  
  455. create database if not exists `edmshard16`;  
  456. USE `edmshard16`;  
  457. DROP TABLE IF EXISTS `email_info`;  
  458. 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;  
  459. DROP TABLE IF EXISTS `email_info_detail`;  
  460. 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;  
  461. /**==================================================**/  


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

    1. package com.gen.sql;  
    2.   
    3. public class GenShardSql {  
    4.   
    5.     /**  
    6.      * @param args  
    7.      */  
    8.     public static void main(String[] args) {  
    9.         // TODO Auto-generated method stub  
    10.   
    11.         //通过cobar进行数据展示  
    12.         String a="use edm;";  
    13.         System.out.println(a);  
    14.           
    15.         System.out.println("/**==================================================**/");  
    16.         GenShardSql gss=new GenShardSql();  
    17.         //清理主库以及分区库  
    18.         gss.clearDate();  
    19.           
    20.         System.out.println("/**==================================================**/");  
    21.         //给主库增加数据  
    22.         gss.println_edm_hd(100);  
    23.         System.out.println("/**==================================================**/");  
    24.         //给分区库增加数据  
    25.         gss.println_email_info(100);  
    26.         System.out.println("/**==================================================**/");  
    27.           
    28.         gss.println_email_info_detail(100);  
    29.         System.out.println("/**==================================================**/");  
    30.         //修改数据  
    31.         gss.modifyEmailData(1, 16, 88888);  
    32.           
    33.         //初始化分区库  
    34.         gss.initdb(1, 16);  
    35.   
    36.     }  
    37.       
    38.     public void clearDate(){  
    39.         //清理主库  
    40.         String del="delete from edm_users;";  
    41.         System.out.println(del);  
    42.           
    43.         //清理分区库  
    44.         del="delete from email_info;";  
    45.         System.out.println(del);  
    46.         //清理分区库  
    47.         del="delete from email_info_detail;";  
    48.         System.out.println(del);  
    49.     }  
    50.       
    51.     public void println_email_info(int num){  
    52.         String a="";  
    53.         for(int i=0;i<num;i++){  
    54.             a="insert  into email_info(email,num,note) values (\'hdedm"+i+"@hc360.com\',"+i+",\'aa\');";  
    55.             System.out.println(a);  
    56.         }  
    57.     }  
    58.       
    59.     public void println_email_info_detail(int num){  
    60.         String b="";  
    61.         for(int i=0;i<num;i++){  
    62.             b="insert  into email_info_detail(email,num_a,num_b) values ('hdedm"+i+"@hc360.com',"+i+","+-i+");";  
    63.             System.out.println(b);  
    64.         }  
    65.     }  
    66.       
    67.       
    68.     public void println_edm_hd(int num){  
    69.         String a="use edm;";  
    70.         System.out.println(a);  
    71.         String b="";  
    72.         for(int i=0;i<num;i++){  
    73.              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));";  
    74.              System.out.println(b);  
    75.         }  
    76.           
    77.           
    78.     }  
    79.     /**初始化分区DB*/  
    80.     public void initdb(int start,int end){  
    81.         for(int i=start;i<=end;i++){  
    82.             String create="create database if not exists `edmshard"+i+"`;";  
    83.             String use="USE `edmshard"+i+"`;";  
    84.             String drop1="DROP TABLE IF EXISTS `email_info`;";  
    85.             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;";  
    86.           
    87.             String drop2="DROP TABLE IF EXISTS `email_info_detail`;";  
    88.             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;";  
    89.           
    90.           
    91.             System.out.println(create);  
    92.             System.out.println(use);  
    93.             System.out.println(drop1);  
    94.             System.out.println(c_t1);  
    95.             System.out.println(drop2);  
    96.             System.out.println(c_t2);  
    97.               
    98.             System.out.println("/**==================================================**/");  
    99.         }  
    100.   
    101.     }  
    102.       
    103.   
    104.     /**  
    105.      * 根据邮箱更改某个分区的数据  
    106.      * */  
    107.     public void modifyEmailData(int start,int end,int val){  
    108.         String ms="";  
    109.         for(int i=start;i<end;i++){  
    110.             ms="update email_info ei set ei.num="+val+", ei.create_time=now() where ei.email=\'hdedm"+i+"@hc360.com\';";  
    111.             System.out.println(ms);  
    112.         }  
    113.         System.out.println("/**==================================================**/");  
    114.         for(int i=start;i<end;i++){  
    115.             ms="update email_info_detail eid set eid.num_a="+val+", eid.create_time=now() where eid.email=\'hdedm"+i+"@hc360.com\';";  
    116.             System.out.println(ms);  
    117.         }  
    118.         System.out.println("/**==================================================**/");  
    119.     }   
posted on 2014-12-02 10:17  鞋垫  阅读(541)  评论(0)    收藏  举报