3.下载安装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]# lldrwxr-xr-x. 2 root root 4096 Dec 29 2012 bindrwxr-xr-x. 2 root root 4096 Dec 29 2012 conf-rwsrwsrwt. 1 root root 575 Dec 29 2012 COPYRIGHTdrwxr-xr-x. 3 root root 4096 May 14 10:13 lib-rwsrwsrwt. 1 root root 11549 Dec 29 2012 LICENSEdrwxr-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-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 --test架构名,用于用户登陆,test1第一个数据库
--t1是表名,拆分的表,test2,test3是两个数据库名 --test1是第一个数据库test[0] --第一个数据库源 --第二个数据库test[1] --第三个数据库test[2] --test源数据,用于用户登陆192.168.1.247:3306/test1 --三个数据库服务器和数据库名,数据库也可在不同的服务器上192.168.1.247:3306/test2192.168.1.247:3306/test3tong --用户登陆system --密码STRICT_TRANS_TABLES[root@tong1 conf]# vim rule.xmlid2512[root@tong1 conf]# vim server.xml8066 --cobar服务启动端口9066 --管理端口1644488_HEARTBEAT_USER__HEARTBEAT_PASS_ --登陆用户名system --密码test --架构名,用户连接的数据库[root@tong1 bin]# ./startup.sh --启动服务"/usr/local/jdk1.7.0_71/bin/java" -Dcobar.home="/usr/local/cobar-server-1.2.7" -classpath "/usr/local/cobar-server-1.2.7/conf:/usr/local/cobar-server-1.2.7/lib/classes:/usr/local/cobar-server-1.2.7/lib/cobar-server-1.2.7.jar:/usr/local/cobar-server-1.2.7/lib/log4j-1.2.16.jar" -server -Xms1024m -Xmx1024m -Xmn256m -Xss256k -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:+UseFastAccessorMethods -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=75 com.alibaba.cobar.CobarStartup >> "/usr/local/cobar-server-1.2.7/logs/console.log" 2>&1 &[root@tong1 bin]# cat ../logs/stdout.log --查看日志15:33:02,933 INFO ===============================================15:33:02,934 INFO Cobar is ready to startup ...15:33:02,934 INFO Startup processors ...15:33:03,026 INFO Startup connector ...15:33:03,031 INFO Initialize dataNodes ...15:33:03,051 INFO test2:0 init success15:33:03,053 INFO test1:0 init success15:33:03,055 INFO test3:0 init success15:33:03,066 INFO CobarManager is started and listening on 906615:33:03,068 INFO CobarServer is started and listening on 806615:33:03,071 INFO ===============================================[root@tong1 bin]# cat ../logs/console.loglog4j:WARN 2015-05-14 15:33:02 [/usr/local/cobar-server-1.2.7/conf/log4j.xml] load completed.[root@tong1 bin]# netstat -antup | grep javatcp 0 0 :::8066 :::* LISTEN 25359/javatcp 0 0 :::9066 :::* LISTEN 25359/javatcp 0 0 ::ffff:192.168.1.247:52451 ::ffff:192.168.1.247:3306 ESTABLISHED 25359/javatcp 0 0 ::ffff:192.168.1.247:52450 ::ffff:192.168.1.247:3306 ESTABLISHED 25359/javatcp 0 0 ::ffff:192.168.1.247:52452 ::ffff:192.168.1.247:3306 ESTABLISHED 25359/java[root@tong1 bin]#gge加MySQL_mysql分布式中间件cobar
最新推荐文章于 2022-06-07 00:37:10 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)