码迷,mamicode.com
首页 > 数据库 > 详细

mysql分布式中间件cobar

时间:2015-05-14 12:21:54      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:mysql分布式中间件cobar

Cobar的分布式主要是通过将表放入不同的库来实现:
     1.Cobar支持将一张表水平拆分成多份分别放入不同的库来实现表的水平拆分
     2.Cobar也支持将不同的表放入不同的库
     3.多数情况下,用户会将以上两种方式混合使用
     4.Cobar不支持将一张表,例如test表拆分成test_1, test_2, test_3.....放在同一个库中,必须将拆分后的表分别放入不同的库来实现分布式

 

环境规划:

IP                         数据库      表

192.168.1.247        test01       t1

192.168.1.247        test02       t1

192.168.1.247        test03       t1

 

1.创建数据库和表

[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, 2015, 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;                 --创建数据库test01,02,03
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));             --在三个数据库创建相同的表
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> exit
Bye
[root@tong1 ~]#

 

2.下载安装cobar

下载地址:http://pan.baidu.com/s/1o6igLwY

[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 root  4096 Dec 29  2012 bin
drwxr-xr-x. 2 root root  4096 Dec 29  2012 conf
-rwsrwsrwt. 1 root root   575 Dec 29  2012 COPYRIGHT
drwxr-xr-x. 3 root root  4096 May 14 10:13 lib
-rwsrwsrwt. 1 root root 11549 Dec 29  2012 LICENSE
drwxr-xr-x. 2 root root  4096 Dec 29  2012 logs
-rwsrwsrwt. 1 root root   428 Dec 29  2012 README

[root@tong1 cobar-server-1.2.7]# cd conf/
[root@tong1 conf]# ll
total 16
-rw-r--r--. 1 root root 2604 Dec 29  2012 log4j.xml
-rw-r--r--. 1 root root 1262 Dec 29  2012 rule.xml
-rw-r--r--. 1 root root 1966 Dec 29  2012 schema.xml    --mysql数据库的IP,端口
-rw-r--r--. 1 root root 2292 Dec 29  2012 server.xml

[root@tong1 conf]# vim schema.xml

本文出自 “一起走过的日子” 博客,请务必保留此出处http://tongcheng.blog.51cto.com/6214144/1651162

mysql分布式中间件cobar

标签:mysql分布式中间件cobar

原文地址:http://tongcheng.blog.51cto.com/6214144/1651162

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!