新手体验OceanBase社区版V4.2:离线部署单节点集群

本文源自OceanBase用户的分享

先简单总结如下:

1.本文适合初学者体验OceanBase社区版 v4.2.2

2.仅需准备一台配置为2C/8G的Linux虚拟机

3.通过离线方式安装,以便更直观地了解安装过程

一、Linux系统准备

在宿主机(即你的windows PC电脑)上安装vbox软件,点击新建按钮,输入自定义名称,文件夹为Linux虚拟机的安装路径。

内存大小设置为8G,尝试过分配4G,后期安装时会提示内存不足

虚拟硬盘的文件类型,如果想与vmware等其它虚拟机软件通用,可选择VMDK

这里分配100G的动态空间,实际并不会真正地占用宿主机100G空间,所以不必担心

选中新建的虚拟机-obdb,点击设置

在左侧系统选项卡中设置光驱文件、处理器等

注意此处要将默认加载的光驱删掉,不然后面VBOX软件会出BUG

网络连接方式选择host-only,即离线模式

光标向上选择到Install选项,回车进行下一步

Ps:安装期间如果想从虚拟机窗体中返回到你的pc桌面,可以按右侧的ctrl键

点击左上方的DONE按钮

软件集选择Server with GUI,方便后面配置网卡等

选择I will configure partitioning选项,之后点击左上方DONE后会进入磁盘分区,各分区大小按下方设置即可

/swap这个特殊,文件类型要选择swap

DONE

ACCEPT CHANGES,这里如果用鼠标选不到,可以使用TAB键

关闭kdump

设置主机名,网卡的自动启动,其实这步不设置也没事,后面还要重复设置

Ps:这里不要点configure配置IP信息,点了后你将陷入深坑

关闭安全策略

Begin installation

在这里点击ROOT PASSWORD为root用户设置口令,我通常设置为123456,你随意

接下来就是

REBOOT

LICENSE INFORMATION处接受下即可

重复的步骤又来了,还是不要点击右下角的configure

全部完成后点击右下角finish configuration,之后会进入Linux的欢迎界面

点击Applications->System Tools->Settings

设置网络IP信息等

设置完后验证一下ip是否设置成功

下面在你的宿主机(windows PC电脑)上安装个连接工具,SecureCRT,百度就有,找不到的留言我发你,新建个连接,输入ip、用户名及密码

下面关闭Linux的防火墙和Selinux,不然后面使用obd web、ocp express时会访问失败

[root@obdb ~]# systemctl stop firewalld.service [root@obdb ~]# systemctl disable firewalld.service
[root@obdb ~]# vi /etc/selinux/config --将SELINUX=enforcing改为disabled
修改完后重启一下Linux,root用户执行init 6或reboot均可 [root@obdb ~]# init 6

至此,Linux系统准备完毕

二、安装ob集群各组件

1.下载安装包

ALL-IN-ONE安装包https://www.oceanbase.com/softwarecenter,安装包名称为oceanbase-all-in-one-4.2.2.0-100010012024022719.el7.x86_64.tar.gz

Ps:注意区分好架构x86还是arm,如何区分?root用户执行lscpu,结果中的第一行即是

将此安装包存放在你的windows宿主机的C://soft/下

2.上传安装包到Linux虚拟机

右键点击SecureCRT中创建的连接标签,使用sftp进行上传

lcd c:/soft为指定安装包所在windows宿主机的位置

cd /soft为指定Linux虚拟机的目的位置

put为上传(即windows宿主机到Linux虚拟机的传输)

3.安装OBD

[root@obdb ~]# cd /soft/ [root@obdb soft]# ls oceanbase-all-in-one-4.2.2.0-100010012024022719.el7.x86_64.tar.gz [root@obdb soft]# tar -xzf oceanbase-all-in-one-4.2.2.0-100010012024022719.el7.x86_64.tar.gz [root@obdb soft]# cd /soft/oceanbase-all-in-one/rpms/ [root@obdb soft]# rpm -ivh ob-deploy-2.6.2-2.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:ob-deploy-2.6.2-2.el7 ################################# [100%] Installation of obd finished successfully Please source /etc/profile.d/obd.sh to enable it [root@obdb soft]# source /etc/profile.d/obd.sh
[root@obdb soft]# useradd admin [root@obdb ~]# chown -R admin:admin /soft/

以网页形式运行obd

[admin@obdb ~]$ obd web start OBD WEB in 0.0.0.0:8680 please open http://192.168.56.200:8680

打开windows宿主机的浏览器,输入http://192.168.56.200:8680

可以看到各组件后面都有个红叉,因为咱们的虚拟机没有联网,不支持在线安装,需要离线安装,下面介绍使用obd离线安装

首先查看一下obd镜像库

[admin@obdb ~]$ obd mirror list [ERROR] Another app is currently holding the obd lock. Trace ID: ca3e042c-e4c9-11ee-908d-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace ca3e042c-e4c9-11ee-908d-080027b82be3

遇到了错误,原因是咱之前执行了obd web,把执行obd web的SecureCRT窗口ctrl+c后再尝试就可以了

再次执行obd mirror list,共返回三行,两个远程端,一个本地端,对于离线安装需要将所需的组件安装包注册到local本地镜像库中

[admin@obdb ~]$ obd mirror list local -----------查看本地镜像库安装包 local Package List is empty. Trace ID: c50b0132-e4d1-11ee-9492-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace c50b0132-e4d1-11ee-9492-080027b82be3 [admin@obdb ~]$ [admin@obdb ~]$ cd /soft/oceanbase-all-in-one/rpms/ -----------all-in-one自带的安装包位置 [admin@obdb rpms]$ obd mirror clone *.rpm -----------注册所有安装包至本地镜像库 [admin@obdb rpms]$ obd mirror list local -----------再次查看本地镜像库安装包,发现已成功注册 +------------------------------------------------------------------------------------------------------------------+ | local Package List | +---------------------------+---------+------------------------+--------+------------------------------------------+ | name | version | release | arch | md5 | +---------------------------+---------+------------------------+--------+------------------------------------------+ | grafana | 7.5.17 | 1 | x86_64 | 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6 | | obagent | 4.2.2 | 100000042024011120.el7 | x86_64 | 19739a07a12eab736aff86ecf357b1ae660b554e | | ob-configserver | 1.0.0 | 2.el7 | x86_64 | feca6b9c76e26ac49464f34bfa0780b5a8d3f4a0 | | ob-deploy | 2.6.1 | 6.el7 | x86_64 | e9a0a7af5ecedd7a267ccef44e64b6323ea568c2 | | obproxy-ce | 4.2.1.0 | 11.el7 | x86_64 | 0aed4b782120e4248b749f67be3d2cc82cdcb70d | | oceanbase-ce | 4.2.2.0 | 100010012024022719.el7 | x86_64 | 60fe842818ef64631dd3bb6f90bf4cab0e737195 | | oceanbase-ce-libs | 4.2.2.0 | 100010012024022719.el7 | x86_64 | 756bc0a7949701b0a6c707a29cf623f7fb966bb7 | | oceanbase-diagnostic-tool | 1.5.2 | 22024010415.el7 | x86_64 | 4c0f0551be4ad04bc40a66763f66f76fb8bdf10c | | ocp-express | 4.2.2 | 100000022024011120.el7 | x86_64 | 09ffcf156d1df9318a78af52656f499d2315e3f7 | | prometheus | 2.37.1 | 10000102022110211.el7 | x86_64 | 58913c7606f05feb01bc1c6410346e5fc31cf263 | +---------------------------+---------+------------------------+--------+------------------------------------------+ Trace ID: c28f8d64-e4d2-11ee-ad35-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace c28f8d64-e4d2-11ee-ad35-080027b82be3

OBD使用手册:https://www.oceanbase.com/docs/community-obd-cn-1000000000519118

注册完obd local镜像库后重新以admin用户执行obd web并访问http://192.168.56.200:8680便可继续安装部署了,小红叉也消失了

这里默认为3个zone,将下面的2个zone删掉,输入Linux虚拟机IP,下面输入admin的口令即可下一步

这里的安装目录使用默认即可,实际生产环境是需要严格设置的

执行预检查

Duang!遇到问题了

原因:OBD-1007: (192.168.56.200) The value of the ulimit parameter "open files" must not be less than 20000 (Current value: 1024)

建议:Please execute `echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf` as root in 192.168.56.200. if it dosen't work, please check whether UsePAM is yes in /etc/ssh/sshd_config.

如建议提示所述,以root用户登陆,执行echo -e "* soft nofile 20000\n* hard nofile 20000" >> /etc/security/limits.d/nofile.conf,回到界面重新检查便可通过,太人性了!

安装部署完成,提示的信息需要记录下

ps:如果忘记了可以使用如下命令查阅,这一点也值得夸赞

[admin@obdb ~]$ obd cluster display myoceanbase Get local repositories and plugins ok Open ssh connection ok Cluster status check ok Connect to observer 192.168.56.200:2881 ok Wait for observer init ok +--------------------------------------------------+ | observer | +----------------+---------+------+-------+--------+ | ip | version | port | zone | status | +----------------+---------+------+-------+--------+ | 192.168.56.200 | 4.2.2.0 | 2881 | zone1 | ACTIVE | +----------------+---------+------+-------+--------+ obclient -h192.168.56.200 -P2881 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A Connect to obproxy ok +--------------------------------------------------+ | obproxy | +----------------+------+-----------------+--------+ | ip | port | prometheus_port | status | +----------------+------+-----------------+--------+ | 192.168.56.200 | 2883 | 2884 | active | +----------------+------+-----------------+--------+ obclient -h192.168.56.200 -P2883 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A Connect to Obagent ok +-------------------------------------------------------------------+ | obagent | +----------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +----------------+--------------------+--------------------+--------+ | 192.168.56.200 | 8089 | 8088 | active | +----------------+--------------------+--------------------+--------+ Connect to ocp-express ok +-------------------------------------------------------------------+ | ocp-express | +----------------------------+----------+------------------+--------+ | url | username | initial password | status | +----------------------------+----------+------------------+--------+ | http://192.168.56.200:8180 | admin | %M5Kh6@y | active | +----------------------------+----------+------------------+--------+ Trace ID: 28ac73a4-e4f2-11ee-81de-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace 28ac73a4-e4f2-11ee-81de-080027b82be3

这时候obd web界面就可以关掉了,直接ctrl+c就可以

三、使用体验

1.当你不知道这台主机安装了哪些集群的情况下怎么办?可以使用obd命令进行查询

[admin@obdb ~]$ obd cluster list +----------------------------------------------------------------------+ | Cluster List | +-------------+--------------------------------------+-----------------+ | Name | Configuration Path | Status (Cached) | +-------------+--------------------------------------+-----------------+ | myclustljc | /home/admin/.obd/cluster/myclustljc | configured | | myclusljc | /home/admin/.obd/cluster/myclusljc | configured | | myljc | /home/admin/.obd/cluster/myljc | configured | | myoceanbase | /home/admin/.obd/cluster/myoceanbase | running | +-------------+--------------------------------------+-----------------+ Trace ID: 3c3c85a4-e4f1-11ee-8ff4-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace 3c3c85a4-e4f1-11ee-8ff4-080027b82be3

Duang!我的为什么会有4个集群?因为前三个失败了,但是这里还会显示状态为configured,这个咋清理掉呢?我是小白,真不会啊

2.集群的停止

[admin@obdb ~]$ obd cluster stop myoceanbase Get local repositories ok Search plugins ok Open ssh connection ok Stop observer ok Stop obshell ok Stop obproxy ok Stop obagent ok Stop ocp-express ok myoceanbase stopped Trace ID: 08bcff70-e518-11ee-b437-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace 08bcff70-e518-11ee-b437-080027b82be3 [admin@obdb ~]$

3.集群的启动

[admin@obdb ~]$ obd cluster start myoceanbase Get local repositories ok Search plugins ok Load cluster param plugin ok Open ssh connection ok Check before start observer ok Check before start obproxy ok Check before start obagent ok Check before start ocp-express ok Start observer ok observer program health check ok obshell program health check ok Connect to observer 192.168.56.200:2881 ok Start obproxy ok obproxy program health check ok Connect to obproxy ok Initialize obproxy-ce ok Start obagent ok obagent program health check ok Connect to Obagent ok Start ocp-express ok ocp-express program health check ok Connect to ocp-express ok Initialize ocp-express ok Wait for observer init ok +--------------------------------------------------+ | observer | +----------------+---------+------+-------+--------+ | ip | version | port | zone | status | +----------------+---------+------+-------+--------+ | 192.168.56.200 | 4.2.2.0 | 2881 | zone1 | ACTIVE | +----------------+---------+------+-------+--------+ obclient -h192.168.56.200 -P2881 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A +--------------------------------------------------+ | obproxy | +----------------+------+-----------------+--------+ | ip | port | prometheus_port | status | +----------------+------+-----------------+--------+ | 192.168.56.200 | 2883 | 2884 | active | +----------------+------+-----------------+--------+ obclient -h192.168.56.200 -P2883 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A +-------------------------------------------------------------------+ | obagent | +----------------+--------------------+--------------------+--------+ | ip | mgragent_http_port | monagent_http_port | status | +----------------+--------------------+--------------------+--------+ | 192.168.56.200 | 8089 | 8088 | active | +----------------+--------------------+--------------------+--------+ +-------------------------------------------------------------------+ | ocp-express | +----------------------------+----------+------------------+--------+ | url | username | initial password | status | +----------------------------+----------+------------------+--------+ | http://192.168.56.200:8180 | admin | %M5Kh6@y | active | +----------------------------+----------+------------------+--------+ myoceanbase running Trace ID: 277e4c2a-e518-11ee-939f-080027b82be3 If you want to view detailed obd logs, please run: obd display-trace 277e4c2a-e518-11ee-939f-080027b82be3

4.使用客户端登陆数据库

[admin@obdb ~]$ obclient -h192.168.56.200 -P2881 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A bash: obclient: command not found...

Duang!Duang! 客户端工具还没安装https://www.oceanbase.com/softwarecenter下找到\[OceanBase 命令行客户端]下载obclient-2.2.3-1.el7.x86_64.rpm并上传到虚拟机上

sftp> lcd c:/soft/ sftp> cd /soft/ sftp> put obclient-2.2.3-1.el7.x86_64.rpm Uploading obclient-2.2.3-1.el7.x86_64.rpm to /soft/obclient-2.2.3-1.el7.x86_64.rpm 100% 11656KB 11656KB/s 00:00:00 c:/soft/obclient-2.2.3-1.el7.x86_64.rpm: 11936672 bytes transferred in 0 seconds (11656 KB/s) sftp>
[root@obdb ~]# cd /soft/ [root@obdb soft]# rpm -ivh obclient-2.2.3-1.el7.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:obclient-2.2.3-1.el7 ################################# [100%]
[root@obdb soft]# su - admin Last login: Mon Mar 18 19:00:48 CST 2024 on pts/0 [admin@obdb ~]$ [admin@obdb ~]$ obclient -h192.168.56.200 -P2881 -uroot -p'r5]g0aBWhZVSh%;*)KukQl}whz~@' -Doceanbase -A Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221562009 Server version: OceanBase_CE 4.2.2.0 (r100010012024022719-c984fe7cb7a4cef85a40323a0d073f0c9b7b8235) (Built Feb 27 2024 19:20:54) 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]>

客户端登陆没问题了

5.登陆ocp express

新建个租户

ocp express绝对是轻量级,这么低的配置跑起来非常轻松

在ocp express界面还可以体验监控、诊断分析、日志、修改参数等功能,绝非鸡肋!

到这里体验完成,下个目标:扩展集群节点

相关推荐
OceanBase数据库官方博客1 天前
OceanBase 中常用的查询语句
sql·oceanbase·分布式数据库·查询语句
OceanBase数据库官方博客4 天前
如何解决JAVA程序通过obloader并发导数导致系统夯住的问题 | OceanBase 运维实践
java·运维·oceanbase·分布式数据库
OceanBase数据库官方博客4 天前
如何配置 Flink CDC 连接 OceanBase 实现数据实时同步
大数据·flink·oceanbase·分布式数据库
OceanBase数据库官方博客4 天前
如何实现主备租户的无缝切换 | OceanBase应用实践
oceanbase·分布式数据库·高可用
靖顺6 天前
【OceanBase 诊断调优】—— ocp上针对OB租户CPU消耗计算逻辑
oceanbase
一名数据库爱好者6 天前
OceanBase 闪回查询
数据库·oceanbase·dba
OceanBase数据库官方博客6 天前
ODC 如何精确呈现SQL耗时 | OceanBase 开发者工具解析
sql·oceanbase·分布式数据库·开发者·生态工具
一名数据库爱好者7 天前
OceanBase单表恢复(4.2.1.8)
adb·oceanbase
靖顺7 天前
【OceanBase 诊断调优】—— OceanBase 数据库统计信息被禁用,状态为 broken 的原因和解决方法
数据库·oceanbase
OceanBase数据库官方博客10 天前
如何在 Ubuntu 上 部署 OceanBase
ubuntu·oceanbase·分布式数据库·安装部署