Mysql distributed middleware cobar

Source: Internet
Author: User
Cobar distribution is mainly achieved by placing tables into different databases: 1. cobar supports horizontal splitting of a table into multiple copies and placing them in different databases. 2. cobar also supports placing different tables not ..

Cobar distribution is mainly achieved by placing tables into different databases: 1. cobar supports horizontal splitting of a table into multiple copies and placing them in different databases. 2. cobar also supports placing different tables not ..

Cobar is distributed by placing tables in different databases:
1. Cobar supports horizontal split of a table into multiple copies and put them into different databases to achieve horizontal split of the table.
2. Cobar also supports placing different tables into different databases.
3. In most cases, the user will mix the above two methods
4. cobar does not support splitting a table, such as the test table into test_1, test_2, test_3 ..... in the same database, the split tables must be placed in different databases for distributed processing.


Disadvantages:

1. Cross-database Association operations are not supported: join, paging, sorting, and subquery.

2. The SAVEPOINT operation is not supported.

3. Execution of SET statements is not supported, except for transactions and Character SET setting statements.

4. Only MySQL Data nodes are supported.

5. For a split table, the column name must be provided for the insert operation, and the split field must be included.

Environment Planning:

IP database table

192.168.1.247 test01 t1

192.168.1.247 test02 t1

192.168.1.247 test03 t1

Note: create three databases on the server, create the same table and table type in the database, and split the data in Table t1 to the database teat01 and 02,03.

1. create databases and tables

[Root @ tong1 ~] #/Usr/local/mysql-5.6.23/bin/mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 6028
Server version: 5.6.23-log MySQL Community Server (GPL)

Copyright (c) 2000,201 5, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.

Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.

Mysql> create database test01; -- create database test01
Query OK, 1 row affected (0.03 sec)

Mysql> create database test02;
Query OK, 1 row affected (0.03 sec)

Mysql> create database test03;
Query OK, 1 row affected (0.03 sec)

Mysql> \ u test01
Database changed
Mysql> create table t1 (a int, B char (5); -- create the same table in the three databases
Query OK, 0 rows affected (0.34 sec)

Mysql> \ u test02
Database changed
Mysql> create table t1 (a int, B char (5 ));
Query OK, 0 rows affected (0.31 sec)

Mysql> \ u test03
Database changed
Mysql> create table t1 (a int, B char (5 ));
Query OK, 0 rows affected (0.30 sec)

Mysql> show tables;
+ ------------------ +
| Tables_in_test03 |
+ ------------------ +
| T1 |
+ ------------------ +
1 row in set (0.00 sec)

Mysql> grant all privileges on *. * to tong @ 'localhost' identified by 'system ';
Query OK, 0 rows affected (0.05 sec)

Mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)

Mysql> exit
Bye
[Root @ tong1 bin] #

2. Install the java Development Package

[Root @ tong1 ~] # Tar xvf jdk-7u71-linux-x64.tar.gz-C/usr/local/

[Root @ tong1 ~] # Cd/usr/local/

[Root @ tong1 local] # chown-R root: root jdk1.7.0 _ 71/

[Root @ tong1 local] # vim/etc/profile -- add Environment Variables

Export PATH = $ PATH:/usr/local/protobuf-2.5.0/bin:/usr/local/jdk1.7.0 _ 71/bin
Export JAVA_HOME =/usr/local/jdk1.7.0 _ 71/
Export CLASS_HOME =/usr/local/jdk1.7.0 _ 71/lib

[Root @ tong1 local] #./etc/profile

[Root @ tong1 local] # java-version -- check whether java is successfully installed
Java version "1.7.0 _ 71"
Java (TM) SE Runtime Environment (build 1.7.0 _ 71-b14)
Java HotSpot (TM) 64-Bit Server VM (build 24.71-b01, mixed mode)
[Root @ tong1 local] #

3. Download and install cobar

:

[Root @ tong1 ~] # Tar xvf cobar-server-1.2.7.tar.gz-C/usr/local/

[Root @ tong1 ~] # Cd/usr/local/cobar-server-1.2.7/
[Root @ tong1 cobar-server-1.2.7] # ll
Total 36
Drwxr-xr-x. 2 root 4096 Dec 29 2012 bin
Drwxr-xr-x. 2 root 4096 Dec 29 2012 conf
-Rwsrwsrwt. 1 root 575 Dec 29 2012 COPYRIGHT
Drwxr-xr-x. 3 root 4096 May 14 lib
-Rwsrwsrwt. 1 root 11549 Dec 29 2012 LICENSE
Drwxr-xr-x. 2 root 4096 Dec 29 2012 logs
-Rwsrwsrwt. 1 root 428 Dec 29 2012 README

[Root @ tong1 cobar-server-1.2.7] # cd conf/
[Root @ tong1 conf] # ll
Total 16
-Rw-r --. 1 root 2604 Dec 29 2012 log4j. xml
-Rw-r --. 1 root 1262 Dec 29 2012 rule. xml
-Rw-r --. 1 root 1966 Dec 29 2012 schema. xml -- mysql database IP address, Port
-Rw-r --. 1 root 2292 Dec 29 2012 server. xml

[Root @ tong1 conf] # vim schema. xml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.