今天下午,OceanBase 4.0 all-in-one 版本的包发布出来了,获取地址:OceanBase 社区 。
这个版本,官方承诺大家可以在 4C8G(即 CPU 4 核心,内存 8 GB)的环境下轻松启动和使用。下面我们就简单来看一下整个安装步骤,可以说只用几分钟(2 分钟),就能让你拥有一款单机 OB 数据库。 感谢官方做的优化:
- all-in-one 的安装包里面包含了 OBD、OceanBase 数据库、 OBProxy、obagent、Grafana 和 Prometheus ,不再像以前版本那样一个个下载安装了;
- 另外对于 CPU 和内存使用做了大量的优化,实测在 4C8G 环境下跑的很流畅,当然对于资源的深度挖掘,也让我电脑的 CPU 呼呼转起来了
1. 环境准备
直接上图了,看的直观。
如果要运行官方提供的 demo(
obd demo
),需要把 home
目录搞大一点,/home 下至少需要 54GB 以上的空闲空间。 空间小了会报下面的错误:
[ERROR] (127.0.0.1) /home not enough disk space. (Avail: 8.7G, Need: 54.0G)
2. 一键安装
安装过程很简单,总共分三步:
- 上传软件包并解压缩
- 安装包大小一共 246MB
246M oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
- 安装包大小一共 246MB
- 执行
install.sh
脚本 - 检查是否有错误影响安装(一般没有哈哈)
2.1 解压缩并进入安装脚本目录
[chris@ob40-single ~]$ tar -xzvf oceanbase-all-in-one.4.0.0.0-beta-100120221102135736.el7.x86_64.tar.gz
[chris@ob40-single ~]$ cd oceanbase-all-in-one/bin/
2.2 执行安装脚本 ./install.sh
[chris@ob40-single bin]$ ./install.sh
name: grafana
version: 7.5.17
release:1
arch: x86_64
md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
add /home/chris/oceanbase-all-in-one/rpms/grafana-7.5.17-1.el7.x86_64.rpm to local mirror
name: obagent
version: 1.2.0
release:4.el7
arch: x86_64
md5: 0e8f5ee68c337ea28514c9f3f820ea546227fa7e
add /home/chris/oceanbase-all-in-one/rpms/obagent-1.2.0-4.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.0.0
release:5.el7
arch: x86_64
md5: de53232a951184fad75b15884458d85e31d2f6c3
add /home/chris/oceanbase-all-in-one/rpms/obproxy-ce-4.0.0-5.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.0.0.0
release:100000272022110114.el7
arch: x86_64
md5: 42611dc51ca9bb28f36e60e4406ceea4a74914c7
add /home/chris/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.0.0.0
release:100000272022110114.el7
arch: x86_64
md5: 188919f8128394bf9b62e3989220ded05f1d14da
add /home/chris/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-100000272022110114.el7.x86_64.rpm to local mirror
name: prometheus
version: 2.37.1
release:10000102022110211.el7
arch: x86_64
md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
add /home/chris/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
Disable remote ok
#####################################################################
Install Finished
=====================================================================
Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh
Quick Start: obd demo
More Details: obd -h
=====================================================================
3. 一键体验
官方提供了一键体验(初始化)demo,可以使用 obd demo
命令快速初始化集群,当然在这之前你还需要修改一下操作系统打开文件数 和 /home 目录的空间,否则会像我一样遇到如下的错误。
Check before start observer x
[ERROR] OBD-1007: (127.0.0.1) open files must not be less than 20000 (Current value: 1024)
[WARN] (127.0.0.1) clog and data use the same disk (/home)
[ERROR] (127.0.0.1) /home not enough disk space. (Avail: 8.7G, Need: 54.0G)
解决上面两个配置问题后,执行 obd demo
命令,很顺利的等待 2 分钟,会得到如下结果:
+---------------------------------------------+
| observer |
+-----------+---------+------+-------+--------+
| ip | version | port | zone | status |
+-----------+---------+------+-------+--------+
| 127.0.0.1 | 4.0.0.0 | 2881 | zone1 | ACTIVE |
+-----------+---------+------+-------+--------+
obclient -h127.0.0.1 -P2881 -uroot -Doceanbase
+---------------------------------------------+
| obproxy |
+-----------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884 | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase
+--------------------------------------------------+
| obagent |
+--------------+-------------+------------+--------+
| ip | server_port | pprof_port | status |
+--------------+-------------+------------+--------+
| 10.211.55.84 | 8088 | 8089 | active |
+--------------+-------------+------------+--------+
+-----------------------------------------------------+
| prometheus |
+--------------------------+------+----------+--------+
| url | user | password | status |
+--------------------------+------+----------+--------+
| http://10.211.55.84:9090 | | | active |
+--------------------------+------+----------+--------+
+-------------------------------------------------------------------+
| grafana |
+--------------------------------------+-------+-----------+--------+
| url | user | password | status |
+--------------------------------------+-------+-----------+--------+
| http://10.211.55.84:3000/d/oceanbase | admin | oceanbase | active |
+--------------------------------------+-------+-----------+--------+
demo running
[chris@ob40-single ~]$
看到上面最后日志里的 demo running
,相信大家心里一定是很高兴的,下面我们登陆测试一下是否可以正常使用。
[chris@ob40-single ~]$ obclient -h127.0.0.1 -uroot -P2881
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 3221488051
Server version: OceanBase_CE 4.0.0.0 (r100000272022110114-6af7f9ae79cd0ecbafd4b1b88e2886ccdba0c3be) (Built Nov 1 2022 14:57:18)
Copyright (c) 2000, 2018, OB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [(none)]> select version();
+------------------------------+
| version() |
+------------------------------+
| 5.7.25-OceanBase_CE-v4.0.0.0 |
+------------------------------+
1 row in set (0.001 sec)
obclient [(none)]> use test;
Database changed
obclient [test]> create table t1(id int);
Query OK, 0 rows affected (0.058 sec)
obclient [test]> insert into t1 select * from t1;
Query OK, 196608 rows affected (1.108 sec)
Records: 196608 Duplicates: 0 Warnings: 0
obclient [test]> insert into t1 select * from t1;
Query OK, 393216 rows affected (2.397 sec)
Records: 393216 Duplicates: 0 Warnings: 0
4. 一键关闭
最后,如何让你的小风扇停下来,请执行下面命令:
obd cluster stop demo
-- sudo shutdown -h now -- 慎用
新版本来了,大家一起来玩耍吧~