OceanBase 快速体验系列:
本篇文档适合快速体验 OceanBase 社区版的用户,资源要求低,个人电脑即可操作。
安装并配置 Docker
- 下载并安装 Docker: https://docs.docker.com/get-docker/
- 启动 Docker 后,需要调整容器资源的最大限制。OceanBase Docker 容器对资源的要求如下:
- 可用内存不低于 10G。
- CPU 数目不少于 2 个。
启动 OceanBase 容器
- 拉取 OceanBase 镜像:
$ docker pull oceanbase/oceanbase-ce
- 启动 OceanBase 容器:
# 方式一: 根据当前容器部署最大规格的实例
$ docker run -p 2881:2881 --name obstandalone -d oceanbase/oceanbase-ce
# 方式二: 部署 mini 的独立实例
$ docker run -p 2881:2881 --name obstandalone -e MINI_MODE=1 -d oceanbase/oceanbase-ce
- 刚启动的 OceanBase 容器需要几分钟初始化集群。您可运行如下命令查看容器启动日志:
$ docker logs obstandalone
- 输出:
generate boot.yaml ...
create boot dirs and deploy ob cluster ...
name: oceanbase-ce
version: 3.1.4
release:10000092022071511.el7
arch: x86_64
md5: c5cd94f4f190317b6a883c58a26460a506205ce6
add /root/pkg/oceanbase-ce-3.1.4-10000092022071511.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 3.1.4
release:10000092022071511.el7
arch: x86_64
md5: 6d5437b0cad486b55963f89b8ef3769af7995350
add /root/pkg/oceanbase-ce-libs-3.1.4-10000092022071511.el7.x86_64.rpm to local mirror
+---------------------------------------------------------------------------------------------------------+
| local Package List |
+-------------------+---------+-----------------------+--------+------------------------------------------+
| name | version | release | arch | md5 |
+-------------------+---------+-----------------------+--------+------------------------------------------+
| oceanbase-ce | 3.1.4 | 10000092022071511.el7 | x86_64 | c5cd94f4f190317b6a883c58a26460a506205ce6 |
| oceanbase-ce-libs | 3.1.4 | 10000092022071511.el7 | x86_64 | 6d5437b0cad486b55963f89b8ef3769af7995350 |
+-------------------+---------+-----------------------+--------+------------------------------------------+
Local deploy is empty
Package oceanbase-ce-3.1.4 is available.
install oceanbase-ce-3.1.4 for local ok
Cluster param config check ok
Open ssh connection ok
Generate observer configuration ok
oceanbase-ce-3.1.4 already installed.
+-------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+-----------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+-----------------------+------------------------------------------+
| oceanbase-ce | 3.1.4 | 10000092022071511.el7 | c5cd94f4f190317b6a883c58a26460a506205ce6 |
+--------------+---------+-----------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository install ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check !!
[WARN] 127.0.0.1 oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 require: libmariadb.so.3
Try to get lib-repository
Package oceanbase-ce-libs-3.1.4 is available.
install oceanbase-ce-libs-3.1.4 for local ok
Use oceanbase-ce-libs-3.1.4-6d5437b0cad486b55963f89b8ef3769af7995350 for oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6
Remote oceanbase-ce-libs-3.1.4-6d5437b0cad486b55963f89b8ef3769af7995350 repository install ok
Remote oceanbase-ce-3.1.4-c5cd94f4f190317b6a883c58a26460a506205ce6 repository lib check ok
Cluster status check ok
Initializes observer work home ok
obcluster deployed
Get local repositories and plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (127.0.0.1) clog and data use the same disk (/)
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.4 | 2881 | zone1 | active |
+-----------+---------+------+-------+--------+
obcluster running
Get local repositories and plugins ok
Open ssh connection ok
Connect to observer ok
Create tenant test ok
deploy success!
boot success!
- 可以看到已经启动了一个单节点的 OceanBase 集群:
连接数据库
# 使用 obclient 连接
$ obclient -h127.0.0.1 -P2881 -uroot
# 使用 MySQL 客户端连接
$ mysql -h127.0.0.1 -P2881 -uroot