OceanBase 社区版是一款开源分布式 HTAP(Hybrid Transactional/Analytical Processing)数据库管理系统,具有原生分布式架构,支持金融级高可用、透明水平扩展、分布式事务、多租户和语法兼容等企业级特性。OceanBase 内核通过大规模商用场景的考验,已服务众多行业客户,现面向未来持续构建内核技术竞争力。
OceanBase 数据库将数据以多副本的方式存储在集群的各个节点,可以轻松实现高可用,保证 RPO=0,甚至异地多活。即使单个节点出现故障也不影响业务连续性。多副本能够满足从节点、机架、机房到城市级别的高可用、容灾要求,并且克服传统数据库的主备模式在主节点出现异常时 RPO>0 的问题。
OceanBase 数据库具有极强的可扩展性,可以在线进行平滑扩容或缩容,在扩容后自动实现系统负载均衡。并且扩容或缩容过程对应用透明。
OceanBase 数据库可以在通用服务器上运行,不依赖于特定的高端硬件,能够有效降低用户的硬件成本。OceanBase 数据库使用基于 LSM-Tree 的存储引擎,能够有效地对数据进行压缩,并且不影响性能,可以降低用户的存储成本。
OceanBase 数据库的分布式并行计算引擎对 OLTP 应用和 OLAP 应用都进行了很好的优化,并且支持跨数据库节点的 DQL 和 DML 并发执行,真正实现了一套计算引擎同时支持混合负载。
OceanBase 数据库高度兼容 MySQL 数据库生态。OceanBase 数据库支持 MySQL 5.6 版本全部语法以及兼容 MySQL 5.7 的绝大部分功能和语法,兼容 MySQL 5.7 版本的全量以及 8.0 版本的部分 JSON 函数,可以与 MySQL 业务无缝切换。
OceanBase 数据库通过租户实现资源隔离,每个数据库服务的实例不感知其他实例的存在,并通过权限控制确保不同租户数据的安全性。多租户与 OceanBase 数据库强大的可扩展性相结合,能够提供安全、灵活的 DBaaS 服务。
OBServer :一个集群由若干个 OBServer 节点组成,这些 OBServer 节点分属于若干个区(Zone),每个节点属于一个区。
区域(zone):区是一个逻辑概念,表示集群内具有相似硬件可用性的一组节点,它在不同的部署模式下代表不同的含义。例如,当整个集群部署在同一个数据中心(IDC)内的时候,一个区的节点可以属于同一个机架,同一个交换机等。当集群分布在多个数据中心的时候,每个区可以对应于一个数据中心。
资源池:集群的多个服务器组成了一个大的资源池,管理员会根据各个租户的要求,创建与之对应的虚拟资源池给租户使用,资源池包括指定规格的 CPU、内存、存储等。为了避免租户之间争抢资源,租户之间的资源相互隔离,内存是物理隔离、CPU 是逻辑隔离。
租户:租户是一个逻辑概念。在 OceanBase 数据库中,租户是资源分配的单位,是数据库对象管理和资源管理的基础,对于系统运维,尤其是对于云数据库的运维有着重要的影响。
数据分区:OceanBase 数据库参考传统数据库分区表的概念,把一张表格的数据划分成不同的分区(Partition)。
副本:在分布式环境下,为保证数据读写服务的高可用,OceanBase 数据库会把同一个分区的数据拷贝到多个机器。不同机器同一个分区的数据拷贝称为副本(Replica)。
本次实践仅用于学习或测试,请勿用作实际生产环境!
[root@node ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-10-04 16:38:46 CST; 1 weeks 1 days ago
Docs: https://docs.docker.com
Main PID: 10737 (dockerd)
Tasks: 30
Memory: 3.1G
CGroup: /system.slice/docker.service
└─10737 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Oct 12 18:07:57 node dockerd[10737]: time="2022-10-12T18:07:57.328569696+08:00" level=info msg="Container failed to exit within 10s of signal 15 ...1ab852ac1a
Oct 12 18:07:57 node dockerd[10737]: time="2022-10-12T18:07:57.384199459+08:00" level=info msg="ignoring event" container=30f6dca1b727e77b7b7849b...askDelete"
Oct 12 18:08:56 node dockerd[10737]: time="2022-10-12T18:08:56.539119697+08:00" level=info msg="ignoring event" container=78abf2865642760c2835411...askDelete"
Oct 12 18:09:09 node dockerd[10737]: time="2022-10-12T18:09:09.032710440+08:00" level=info msg="Firewalld: interface br-b27762138079 already part...returning"
Oct 12 18:09:09 node dockerd[10737]: time="2022-10-12T18:09:09+08:00" level=info msg="Firewalld: docker zone already exists, returning"
Oct 12 18:09:10 node dockerd[10737]: time="2022-10-12T18:09:10+08:00" level=info msg="Firewalld: docker zone already exists, returning"
Oct 13 00:31:11 node dockerd[10737]: time="2022-10-13T00:31:11.723361705+08:00" level=info msg="ignoring event" container=60da6bf8b67f1f1d1c757fe...askDelete"
Oct 13 00:31:11 node dockerd[10737]: time="2022-10-13T00:31:11.739408939+08:00" level=info msg="ignoring event" container=fcc5b80d5781e9529dbb20e...askDelete"
Oct 13 00:31:21 node dockerd[10737]: time="2022-10-13T00:31:21.401083141+08:00" level=info msg="Container failed to exit within 10s of signal 15 ...4c7b59e82c
Oct 13 00:31:21 node dockerd[10737]: time="2022-10-13T00:31:21.440992802+08:00" level=info msg="ignoring event" container=bda2272b067edb26b814c83...askDelete"
Hint: Some lines were ellipsized, use -l to show in full.
[root@node ~]# docker -v
Docker version 20.10.17, build 100c701
[root@node ~]# docker pull oceanbase/oceanbase-ce
Using default tag: latest
latest: Pulling from oceanbase/oceanbase-ce
13add961a70d: Pull complete
c8175aff0e18: Pull complete
39c994bcc219: Pull complete
71a870d28c6f: Pull complete
Digest: sha256:6c3f458abc38a017e604af1188726174b6dc81f38c96e2869dc2cb04931a8cd8
Status: Downloaded newer image for oceanbase/oceanbase-ce:latest
docker.io/oceanbase/oceanbase-ce:latest
[root@node ob]# docker run -d -p 2881:2881 -v /data/ob:/root/ob -v $PWD/obd:/root/.obd --name oceanbase oceanbase/oceanbase-ce
7897bb6ccab310a2851dfefe1dccfe5adac8878aa1942380da337bc30be7abc9
[root@node ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bbe4c38abb55 oceanbase/oceanbase-ce "/bin/sh -c _boot" 3 seconds ago Up 2 seconds 0.0.0.0:2881->2881/tcp, :::2881->2881/tcp oceanbase
[root@node ob]# docker logs oceanbase |tail -1
boot success!
root@node ob]# docker logs oceanbase
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] OBD-1007: (127.0.0.1) The recommended number of open files is 655350 (Current value: %s)
[WARN] (127.0.0.1) clog and data use the same disk (/root/ob)
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
[root@node ob]# docker logs oceanbase |tail -1
boot success!
[root@node ob]# docker exec -it oceanbase ob-mysql sys
login as root@sys
Command is: obclient -h127.1 -uroot@sys -A -Doceanbase -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221487655
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]>
[root@node ob]# docker exec -it oceanbase ob-mysql root
login as root@test
Command is: obclient -h127.1 -uroot@test -A -Doceanbase -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221487669
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]>
[root@node ob]# docker exec -it oceanbase ob-mysql test
login as test@test
Command is: obclient -h127.1 -utest@test -A -Dtest -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221487678
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2022, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [test]>
[root@node ob]# mysql -uroot -h127.0.0.1 -P2881
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3221487687
Server version: 5.7.25 OceanBase 3.1.4 (r10000092022071511-b4bfa011ceaef428782dcb65ae89190c40b78c2f) (Built Jul 15 2022 11:45:14)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>