【原创】使用Docker试用阿里的oceanbase分布式数据集

9 篇文章 0 订阅
4 篇文章 0 订阅

本文使用基于CentOS 8的Docker来测试运行oceanbase数据库。
前提要求:
功能学习,CPU至少两核,硬件内存至少10G,磁盘空间至少10G。
如果要做性能测试,需要24核,128G内存,SSD 500G 以上
若要用于生产环境,需要32核,256G内存,SSD 2T 以上,且至少“三台”这样的计算机。

本文,仅限功能学习,最小化配置:CentOS 8+ Docker。

第一步,安装docker工具

yum install -y yum-utils

第二步,添加yum源

yum-config-manager  --add-repo   https://download.docker.com/linux/centos/docker-ce.repo

第三步,安装 docker

yum install -y docker-ce docker-ce-cli containerd.io

第四步,启用和启动docker服务

systemctl enable docker
systemctl start docker

第五步,拉取 OceanBase 数据库相关镜像

docker pull oceanbase/obce-mini

第六步,启动 OceanBase Docker 容器

docker run \
-p 2881:2881 \
--name obce-mini \
-d \
-e OB_HOME_PATH="/root/obce/" \
-e OB_TENANT_NAME="obmysql" \
--restart=always \
oceanbase/obce-mini

第七步,查看容器启动日志

docker logs obce-mini

输出如下信息,表示启动完成

generate boot.yaml ...
create boot dirs and deploy ob cluster ...
Package oceanbase-ce-3.1.0 is available.
install oceanbase-ce-3.1.0 for local ok
+-----------------------------------------------------------------------------+
|                                   Packages                                  |
+--------------+---------+---------+------------------------------------------+
| Repository   | Version | Release | Md5                                      |
+--------------+---------+---------+------------------------------------------+
| oceanbase-ce | 3.1.0   | 2.el7   | afd11d52f83eef4b456d77969fde620c4bfba85e |
+--------------+---------+---------+------------------------------------------+
Open ssh connection ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository install ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository lib check !!
[WARN] 127.0.0.1 oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e require: libaio.so.1
[WARN] 127.0.0.1 oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e require: libmariadb.so.3

Try to get lib-repository
Package oceanbase-ce-libs-3.1.0 is available.
install oceanbase-ce-libs-3.1.0 for local ok
Use oceanbase-ce-libs-3.1.0-47300ca1ac4c62493caf3e9235b105e242e533b5 for oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e
Remote oceanbase-ce-libs-3.1.0-47300ca1ac4c62493caf3e9235b105e242e533b5 repository install ok
Remote oceanbase-ce-3.1.0-afd11d52f83eef4b456d77969fde620c4bfba85e repository lib check ok
Cluster status check ok
127.0.0.1 initializes cluster work home
mini-ce deployed
start ob cluster ...
Get local repositories and plugins ok
Open ssh connection ok
Cluster param config check ok
Check before start observer ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster
Cluster bootstrap ok
Wait for observer init ok
+---------------------------------------------+
|                   observer                  |
+-----------+---------+------+-------+--------+
| ip        | version | port | zone  | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 3.1.0   | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+

mini-ce running
generate init_tenant.sql ...
init tenant and sysbench database ...
boot success!

第八步,安装 oceanbase client,也可以用mysql client

yum-config-manager --add-repo https://mirrors.aliyun.com/oceanbase/OceanBase.repo
yum install -y obclient

第九步,链接oceanbase数据库

obclient -h 127.1 -P2881
#修改root密码
alter user root identified by 'rootPWD123'

查询数据库

MySQL [(none)]> use oceanbase
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MySQL [oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| oceanbase          |
| information_schema |
| mysql              |
| SYS                |
| LBACSYS            |
| ORAAUDITOR         |
| test               |
+--------------------+
7 rows in set (0.004 sec)

Oceanbase Developer Center连接字符串

obclient -h192.168.240.59 -P2881 -uroot@sys -Doceanbase -prootPWD123

官方文档链接
https://open.oceanbase.com/docs/tutorials-cn/V1.0.0/10000000000012294

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赵庆明老师

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值