mysql分布式中介軟體cobar

來源:互聯網
上載者:User

標籤: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.建立資料庫和表

[[email protected] ~]# /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
[[email protected] ~]#

 

2.下載安裝cobar

:http://pan.baidu.com/s/1o6igLwY

[[email protected] ~]# tar xvf cobar-server-1.2.7.tar.gz  -C /usr/local/

[[email protected] ~]# cd /usr/local/cobar-server-1.2.7/
[[email protected] 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

[[email protected] cobar-server-1.2.7]# cd conf/
[[email protected] 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

[[email protected] conf]# vim schema.xml

本文出自 “一起走過的日子” 部落格,請務必保留此出處http://tongcheng.blog.51cto.com/6214144/1651162

mysql分布式中介軟體cobar

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.