虚拟机中mysql-cobar安装_阿里数据库中间件Cobar环境搭建

装了CentOS7,结果死活连不上网,一直提示没有可用的网络设备,没工夫处理,以后再说,先用之前装好的CentOS6.4,Mysql安装包又下不下来,只好翻出了之前玩Storm装的Archlinux,总共有Alpha、Beta、Delta三台虚机,里头安装了JDK、MariaDB等等。

准备

测试中有一个schema,两张表tb1、tb2,其中tb1在一个库,tb2分为两个库。

417a72e9000183d5cbcb1a20975096b8.png

几个Cobar的release包都先下载好。

数据准备,三个数据库表都建好:

#创建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));

注意系统的JAVA_HOME要配置好

配置

Cober的server目录下的conf中的是配置文件

schema.xml中需要修改三个数据库的ip和端口,账号和密码。

server.xml中需要修改Cobar的账号和密码。

启动

通过运行bin目录下的startup.bat来启动Cobar服务,

第一遍没起来,打开startup.bat,其中的APP_VERSION版本和release中的server版本不匹配,log4j的版本也不匹配,修改之后才能正确运行。

logs目录下有Cobar运行的log文件,stdout.log是服务运行的日志,正确运行时是这样:

23:13:00,876 INFO ===============================================

23:13:00,876 INFO Cobar is ready to startup ...

23:13:00,876 INFO Startup processors ...

23:13:00,969 INFO Startup connector ...

23:13:00,969 INFO Initialize dataNodes ...

23:13:01,047 INFO dnTest1:0 init success

23:13:01,063 INFO dnTest3:0 init success

23:13:01,063 INFO dnTest2:0 init success

23:13:01,063 INFO CobarManager is started and listening on 9066

23:13:01,079 INFO CobarServer is started and listening on 8066

23:13:01,079 INFO ===============================================

测试

访问Cobar可以和访问Mysql一样的方式:

>mysql -utest -ptest -P8066 -Ddbtest

959ec82f506e2869cdafed8c90bb5ca8.png

三个库看起来是在一个库,成功~

再实验在Arch下跑Cobar

大部分步骤和Windows下一样,不同的是startup的启动,Linux下运行的是startup.sh。

先是报错:JAVA_HOME environment variable is not set.,但是我的JAVA_HOME已经设定了,虽然用的是openJDK,再查看到有人说JAVA_HOME不应该指向jre,但是openJDK下的java就是软链到jre的,所以把启动脚本中的if [ ! -e "$JAVA_HOME/bin/java" ]注释了。

运行后又失败,没有报错,查看../logs/console.log:

1 OpenJDK Server VM warning: INFO: os::commit_memory(0x7b000000, 805306368, 0) failed; error='Cannot allocate memory' (errno=12)

2 #

3 # There is insufficient memory for the Java Runtime Environment to continue.

4 # Native memory allocation (malloc) failed to allocate 805306368 bytes for committing reserved memory.

5 # An error report file with more information is saved as:

6 # /home/software/cobar-server-1.2.7/hs_err_pid623.log

原来是虚拟机内存不够分配,因为装Arch的时候为了多运行几个,每个只分配了256M内存,而startup.sh中配置如下:

JAVA_OPTS="-server -Xms1024m -Xmx1024m -Xmn256m -Xss256k"

堆内存分了1G,新生代占了整个Arch内存大小,线程栈256k。将参数修改后可以运行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值