Cobar简介
Cobar是阿里巴巴开源(官方github)的一个对应用保持透明的MySQL数据库分布式处理中间件。
Cobar功能
wget https://github.com/alibaba/cobar/releases/download/v1.2.7/cobar-server-1.2.7.tar.gz
tar -zxvf cobar-server-1.2.7.tar.gz
cd cobar-server-1.2.7
#创建dbtest1
drop database if exists dbtest1;
create database dbtest1;
use dbtest1;
#在dbtest1上创建tb1
create table tb1(
id int not null,
gmt datetime);
#创建dbtest2
drop database if exists dbtest2;
create database dbtest2;
use dbtest2;
#在dbtest2上创建tb2
create table tb2(
id int not null,
val varchar(256));
#创建dbtest3
drop database if exists dbtest3;
create database dbtest3;
use dbtest3;
#在dbtest3上创建tb2
create table tb2(
id int not null,
val varchar(256));
dsTest[0]
dsTest[1]
dsTest[2]
192.168.15.130:3306/dbtest1
192.168.15.130:3306/dbtest2
192.168.15.130:3306/dbtest3
root
123456
STRICT_TRANS_TABLES
id
2
512
test
dbtest
./startup.sh
01:34:42,078 INFO ===============================================
01:34:42,078 INFO Cobar is ready to startup ...
01:34:42,079 INFO Startup processors ...
01:34:44,115 INFO Startup connector ...
01:34:44,118 INFO Initialize dataNodes ...
01:34:44,703 INFO dnTest3:0 init success
01:34:44,762 INFO dnTest2:0 init success
01:34:44,915 INFO dnTest1:0 init success
01:34:45,103 INFO CobarManager is started and listening on 9066
01:34:45,133 INFO CobarServer is started and listening on 8066
01:34:45,134 INFO ===============================================
01:37:28,706 INFO [thread=Processor1-H0,class=ServerConnection,host=127.0.0.1,port=51797,schema=dbtest]'test' login success
05:19:14,912 WARN [thread=TimerExecutor3,class=ServerConnection,host=127.0.0.1,port=51797,schema=dbtest] idle timeout
07:41:16,532 INFO [thread=Processor2-H0,class=ServerConnection,host=127.0.0.1,port=51809,schema=dbtest]'test' login success
mysql -h127.0.0.1 -utest -ptest -P8066 -Ddbtest
insert into tb1 values (1,now());