一、前言
OceanBase4.0所采用的架构是单机&分布式一体化架构,这一架构不止是区别于传统中心化的单机数据库,也与传统的分布式架构数据库拉开了差距。小鱼真正实现了从分布式到单机分布式的转折,让OceanBase真正可以按需扩展,从0到1再到N。
本次体验OB4.0 demo 部署花了5分钟,通过obd demo 体验OB4.0真是太方便了。
二、环境准备
工欲善其事,必先利其器。快速部署服务的前提,得需要一个符合基本资源要求的服务器。
根据官网要求:
- 2881和2882端口没有被占用。
- 机器可用memory不低于6G。
- 机器CPU数目不低于2。
- 机器可用disk space不小于54G。
- 打开的文件句柄数量不小于20000。
我的PC是windows,所以直接在阿里云申请了一个ECS实例,8C32G,系统盘500G。因为快速部署,/data或/log盘就不进行区分了,当然生产环境肯定不能这么干。
三、快速部署
从V4.0.0开始,OceanBase提供统一的安装包all-in-one package。可以直接选择在线安装:
bash -c "$(curl -s https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/installer.sh)"
我这边直接执行,压缩包解压的时候报了错,好像解压问题。
所以直接离线安装试试
1、首先下载离线包
wget https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/download-center/opensource/oceanbase-all-in-one/7/x86_64/oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1678180179&OSSAccessKeyId=LTAI5tGVLeRRycCRGerZJMNC&Signature=Mts5x91%2BvMMhrRn3PC2b2lT1lIQ%3DResolving obbusiness-private.oss-cn-shanghai.aliyuncs.com (obbusiness-private.oss-cn-shanghai.aliyuncs.com)... 47.101.83.171
Connecting to obbusiness-private.oss-cn-shanghai.aliyuncs.com (obbusiness-private.oss-cn-shanghai.aliyuncs.com)|47.101.83.171|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 264752498 (252M) [application/gzip]
Saving to: ‘oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1678180179’
100%[============================================================================================================================================================>] 264,752,498 24.7MB/s in 11s
2、执行以下命令解压安装包并进入安装目录。
[root@iZuf6hv8dwa6k80wqfr2sqZ ~]# ll
total 258552
-rw-r--r-- 1 root root 308 Mar 7 13:08 install_cms_agent.log
-rw-r--r-- 1 root root 264752498 Jan 20 18:20 oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1678180179
[root@iZuf6hv8dwa6k80wqfr2sqZ ~]# tar -zxf oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz\?Expires\=1678180179
[root@iZuf6hv8dwa6k80wqfr2sqZ ~]# ll
total 258556
-rw-r--r-- 1 root root 308 Mar 7 13:08 install_cms_agent.log
drwxr-xr-x 7 root root 4096 Jan 13 16:53 oceanbase-all-in-one
-rw-r--r-- 1 root root 264752498 Jan 20 18:20 oceanbase-all-in-one-4.0.0.0-100120230113164218.el7.x86_64.tar.gz?Expires=1678180179
[root@iZuf6hv8dwa6k80wqfr2sqZ ~]# cd oceanbase-all-in-one/bin/
[root@iZuf6hv8dwa6k80wqfr2sqZ bin]# ll
total 12
-rw-r--r-- 1 root root 238 Jan 13 16:42 env.sh
-rwxr-xr-x 1 root root 1558 Jan 13 16:42 install.sh
-rwxr-xr-x 1 root root 161 Jan 13 16:42 uninstall.sh
3、执行安装脚本
[root@iZuf6hv8dwa6k80wqfr2sqZ bin]# sh install.sh
name: grafana
version: 7.5.17
release:1
arch: x86_64
md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
add /root/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 /root/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 /root/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:103000022023011215.el7
arch: x86_64
md5: 1d56dc742f5f05a2d15797d291b51a94019e728d
add /root/oceanbase-all-in-one/rpms/oceanbase-ce-4.0.0.0-103000022023011215.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.0.0.0
release:103000022023011215.el7
arch: x86_64
md5: ef48cff7633e3dbc39f5c0abdcd72348213e09a2
add /root/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.0.0.0-103000022023011215.el7.x86_64.rpm to local mirror
name: prometheus
version: 2.37.1
release:10000102022110211.el7
arch: x86_64
md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
add /root/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
Disable remote ok
add auto set env logic to profile: /root/.bash_profile
#####################################################################
Install Finished
=====================================================================
Setup Environment: source ~/.oceanbase-all-in-one/bin/env.sh
Quick Start: obd demo
More Details: obd -h
=====================================================================
4、设置和验证
根据提示,执行source ~/.oceanbase-all-in-one/bin/env.sh 自动设置好环境变量。
[root@iZuf6hv8dwa6k80wqfr2sqZ bin]#source ~/.oceanbase-all-in-one/bin/env.sh
5、使用 obd demo 快速部署单机体验环境(中间有点warn,但不碍事,如果出现error就得按照提示进行排查了)
[root@iZuf6hv8dwa6k80wqfr2sqZ bin]# obd demo
Package obproxy-ce-4.0.0-5.el7 is available.
Package oceanbase-ce-4.0.0.0-103000022023011215.el7 is available.
Package obagent-1.2.0-4.el7 is available.
Package prometheus-2.37.1-10000102022110211.el7 is available.
Package grafana-7.5.17-1 is available.
install obproxy-ce-4.0.0 for local ok
install oceanbase-ce-4.0.0.0 for local ok
install obagent-1.2.0 for local ok
install prometheus-2.37.1 for local ok
install grafana-7.5.17 for local ok
Cluster param config check ok
Open ssh connection ok
Generate obproxy configuration ok
Generate observer configuration ok
Generate obagent configuration ok
Generate prometheus configuration ok
Generate grafana configuration ok
install obproxy-ce-4.0.0 for local ok
install oceanbase-ce-4.0.0.0 for local ok
install obagent-1.2.0 for local ok
install prometheus-2.37.1 for local ok
install grafana-7.5.17 for local ok
+--------------------------------------------------------------------------------------------+
| Packages |
+--------------+---------+------------------------+------------------------------------------+
| Repository | Version | Release | Md5 |
+--------------+---------+------------------------+------------------------------------------+
| obproxy-ce | 4.0.0 | 5.el7 | de53232a951184fad75b15884458d85e31d2f6c3 |
| oceanbase-ce | 4.0.0.0 | 103000022023011215.el7 | 1d56dc742f5f05a2d15797d291b51a94019e728d |
| obagent | 1.2.0 | 4.el7 | 0e8f5ee68c337ea28514c9f3f820ea546227fa7e |
| prometheus | 2.37.1 | 10000102022110211.el7 | 58913c7606f05feb01bc1c6410346e5fc31cf263 |
| grafana | 7.5.17 | 1 | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 |
+--------------+---------+------------------------+------------------------------------------+
Repository integrity check ok
Parameter check ok
Open ssh connection ok
Cluster status check ok
Initializes obproxy work home ok
Initializes observer work home ok
Initializes obagent work home ok
Initializes prometheus work home ok
Initializes grafana work home ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository install ok
Remote obproxy-ce-4.0.0-5.el7-de53232a951184fad75b15884458d85e31d2f6c3 repository lib check ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository install ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository lib check !!
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository install ok
Remote obagent-1.2.0-4.el7-0e8f5ee68c337ea28514c9f3f820ea546227fa7e repository lib check ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository install ok
Remote prometheus-2.37.1-10000102022110211.el7-58913c7606f05feb01bc1c6410346e5fc31cf263 repository lib check ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository install ok
Remote grafana-7.5.17-1-1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 repository lib check ok
Try to get lib-repository
Package oceanbase-ce-libs-4.0.0.0-103000022023011215.el7 is available.
install oceanbase-ce-libs-4.0.0.0 for local ok
Remote oceanbase-ce-libs-4.0.0.0-103000022023011215.el7-ef48cff7633e3dbc39f5c0abdcd72348213e09a2 repository install ok
Remote oceanbase-ce-4.0.0.0-103000022023011215.el7-1d56dc742f5f05a2d15797d291b51a94019e728d repository lib check ok
demo deployed
Get local repositories ok
Search plugins ok
Open ssh connection ok
Load cluster param plugin ok
Check before start observer ok
[WARN] (127.0.0.1) The recommended value of fs.aio-max-nr is 1048576 (Current value: 65536)
[WARN] OBD-1007: (127.0.0.1) The recommended number of open files is 655350 (Current value: 65535)
[WARN] (127.0.0.1) clog and data use the same disk (/)
Check before start obagent ok
Check before start prometheus ok
Check before start grafana ok
Check before start obproxy ok
Start observer ok
observer program health check ok
Connect to observer ok
Initialize cluster ok
Start obagent ok
obagent program health check ok
Start promethues ok
prometheus program health check ok
Connect to Prometheus ok
Initialize cluster ok
Start grafana ok
grafana program health check ok
Connect to grafana ok
Initialize cluster ok
Start obproxy ok
obproxy program health check ok
Connect to obproxy ok
Initialize cluster ok
Wait for observer init ok
+---------------------------------------------+
| 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 -A
+----------------------------------------------------+
| obagent |
+----------------+-------------+------------+--------+
| ip | server_port | pprof_port | status |
+----------------+-------------+------------+--------+
| 192.168.44.222 | 8088 | 8089 | active |
+----------------+-------------+------------+--------+
+-------------------------------------------------------+
| prometheus |
+----------------------------+------+----------+--------+
| url | user | password | status |
+----------------------------+------+----------+--------+
| http://192.168.44.222:9090 | | | active |
+----------------------------+------+----------+--------+
+---------------------------------------------------------------------+
| grafana |
+----------------------------------------+-------+-----------+--------+
| url | user | password | status |
+----------------------------------------+-------+-----------+--------+
| http://192.168.44.222:3000/d/oceanbase | admin | oceanbase | active |
+----------------------------------------+-------+-----------+--------+
+---------------------------------------------+
| obproxy |
+-----------+------+-----------------+--------+
| ip | port | prometheus_port | status |
+-----------+------+-----------------+--------+
| 127.0.0.1 | 2883 | 2884 | active |
+-----------+------+-----------------+--------+
obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A
demo running
6、连接 OceanBase 数据库实例
[root@iZuf6hv8dwa6k80wqfr2sqZ ~]# obclient -h127.0.0.1 -P2883 -uroot -Doceanbase -A
Welcome to the OceanBase. Commands end with ; or \g.
Your OceanBase connection id is 2
Server version: OceanBase_CE 4.0.0.0 (r103000022023011215-05bbad0279302d7274e1b5ab79323a2c915c1981) (Built Jan 12 2023 15:28:27)
Copyright (c) 2000, 2018, OceanBase and/or its affiliates. All rights reserved.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
obclient [oceanbase]> show tables;
+-------------------------------------------+
| Tables_in_oceanbase |
+-------------------------------------------+
| CDB_INDEXES |
| CDB_IND_COLUMNS |
| CDB_IND_PARTITIONS |
| CDB_IND_SUBPARTITIONS |
三、总结
1、OB4.0小鱼最小资源规格只要2C6G,进一步降低了小白的体验门槛。资源要求缩减的情况,还要保证集群的可靠稳定行,OB团队肯定是下了不少功夫的。
2、作为企业级用户,我深深体会到OB的在易用性上在逐步发力。记得企业版刚开始是用黑屏antman,其实当时感觉antman很方便了,环境检查,初始化,一个脚本完成OCP,OMS的部署,然后通过OCP部署OB集群。后来OB又提供了OAT在线可视化安装平台,可以发现OB的安装部署过程一直在不断简化。到现在社区版4.0之后的obd的一键部署,几分钟即可拉起一个单节点的demo伪分布式系统,极大给使用者或开发学习人员提供的便利。