暂无图片
暂无图片
3
暂无图片
暂无图片
暂无图片

「OceanBase 4.1 体验」快速体验 OceanBase 4.1 数据库 web 白屏部署集群环境

原创 shunwah 2023-05-14
1072

作者:马顺华

从事运维管理工作多年,目前就职于某科技有限公司,熟悉运维自动化、OceanBase部署运维、MySQL 运维以及各种云平台技术和产品。并已获得OceanBase认证OBCA、OBCP 证书、OpenGauss社区认证结业证书。OceanBase & 墨天轮第二、三、四、五、六届技术征文大赛,多次获得 一、二、三 等奖,时常在墨天轮发布原创技术文章,并多次被首页推荐。

image.png

前言

本文以部署 OceanBase 演示环境、部署 OceanBase 集群环境和部署 OceanBase 白屏环境,部署方案为例指导您如何快速使用 OceanBase 数据库。

体验过3.X 的手动安装 OB 和 OBD 工具自动安装 OB,多多少少会遇到各种部署、安装、存储、性能等等问题?OB 白屏部署太人性化了, 支持图形界面,以 UI 的图形界面提供部署,通过 WEB 部署 OB 可以直观地看到 OceanBase 的运行状态。部署过程非常炫酷酷哦,遇到报错还能自动修复,不能自动修复还会提示手动修复的方法,部署中途退出 ,再次登录后,可以继续上次的部署。

注意

本文中的方法仅适用于 OceanBase 数据库快速上手体验,不适用生产环境,如需在生产环境中部署 OceanBase 数据库,请参考 OceanBase 数据库文档中 部署数据库 章节。

本文提供的三种方案中,部署演示环境 和 部署集群环境 同时适用于企业版和社区版部署;部署容器环境 仅适用于社区版部署。

背景信息

OceanBase 数据库自 V4.0.0 开始提供统一的安装包 all-in-one package。您可以通过这个统一的安装包一次性完成 OBD、OceanBase 数据库、ODP、OBAgent、Grafana、Prometheus 的安装,自 V4.1.0 起,all-in-one package 新增支持安装 OCP Express。您可以根据实际需求选择部分或全部组件安装。

方案介绍

为了助力您快速上手体验 OceanBase 数据库,我们提供了不同的方案实现快速部署 Oceanbase 数据,您可以根据自身环境情况灵活选择。

白屏部署 OceanBase 集群环境

此方案适用于需要深入了解 OceanBase 分布式数据库架构原理及功能特性的用户。部署的 OceanBase 集群具备数据库完整能力及分布式高可用的特性。该方案需要您至少准备三台可用资源为 4vCPU、10 GB 内存、50 GB 磁盘的主机。具体操作步骤请参考

当您拥有多台可用机器时,可参考本节内容使用 obd web 命令启动白屏,在白屏界面部署分布式 OceanBase 集群。

说明
本节仅介绍简单的操作,帮助您快速部署一个分布式 OceanBase 集群。更多配置介绍可参考 OBD 文档中 通过白屏部署 OceanBase 集群 一文。

一:下载并安装 all-in-one 安装包

下载 all-in-one 安装包,并将其上传到机器任一目录下。

企业版:请联系技术支持获取 all-in-one 安装包。

本次是部署社区版:请从 OceanBase 软件下载中心 下载 all-in-one 安装包,建议下载最新版本。

在安装包所在目录下执行如下命令解压安装包并安装。

[admin@test001 ~]$ tar -xzf oceanbase-all-in-one-*.tar.gz
[admin@test001 ~]$ cd oceanbase-all-in-one/bin/
[admin@test001 bin]$ ./install.sh
[admin@test001 bin]$ source ~/.oceanbase-all-in-one/bin/env.sh

1. 从 OceanBase 社区下载中心 下载最新的

官方下载地址:https://www.oceanbase.com/softwarecenter
image.png
2. all-in-one package,oceanbase-all-in-one-4.xx.xx-xxx.tar.gz。
image.png

2. 执行以下命令解压安装包并安装。

[root@CAIP131 soft]# ls
obce-3zones.yaml  obce-3zones.yamlbak  oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz  Python-3.9.5  tsar
[root@CAIP131 soft]# tar -xzf oceanbase-all-in-one-4.1.0.0-100120230323143519.el7.x86_64.tar.gz 
[root@CAIP131 soft]# 

image.png

3. 安装 all-in-one

[root@CAIP131 soft]# cd oceanbase-all-in-one/bin/
[root@CAIP131 bin]# ls
env.sh  install.sh  uninstall.sh
[root@CAIP131 bin]# ./install.sh
name: grafana
version: 7.5.17
release:1
arch: x86_64
md5: 1bf1f338d3a3445d8599dc6902e7aeed4de4e0d6
add /root/soft/oceanbase-all-in-one/rpms/grafana-7.5.17-1.el7.x86_64.rpm to local mirror
name: obagent
version: 1.3.0
release:22.el7
arch: x86_64
md5: d57fbb4962b2fbecb6282358c59295fdfba4d6ac
add /root/soft/oceanbase-all-in-one/rpms/obagent-1.3.0-22.el7.x86_64.rpm to local mirror
name: obproxy-ce
version: 4.1.0.0
release:7.el7
arch: x86_64
md5: 2a9d9bf67f179dcca2a8c9e7c77373d94e7e2abe
add /root/soft/oceanbase-all-in-one/rpms/obproxy-ce-4.1.0.0-7.el7.x86_64.rpm to local mirror
name: oceanbase-ce
version: 4.1.0.0
release:100000192023032010.el7
arch: x86_64
md5: 8439ecf8db5e0649bd49671b41ea9e8c85756b63
add /root/soft/oceanbase-all-in-one/rpms/oceanbase-ce-4.1.0.0-100000192023032010.el7.x86_64.rpm to local mirror
name: oceanbase-ce-libs
version: 4.1.0.0
release:100000192023032010.el7
arch: x86_64
md5: a83b1dd1cab44d3f610d439931322be7a08555f2
add /root/soft/oceanbase-all-in-one/rpms/oceanbase-ce-libs-4.1.0.0-100000192023032010.el7.x86_64.rpm to local mirror
name: ocp-express
version: 1.0.0
release:100000432023032015.el7
arch: x86_64
md5: 42c6fc921063f24f9e1072d75bfa7f21f42146e3
add /root/soft/oceanbase-all-in-one/rpms/ocp-express-1.0.0-100000432023032015.el7.x86_64.rpm to local mirror
name: prometheus
version: 2.37.1
release:10000102022110211.el7
arch: x86_64
md5: 58913c7606f05feb01bc1c6410346e5fc31cf263
add /root/soft/oceanbase-all-in-one/rpms/prometheus-2.37.1-10000102022110211.el7.x86_64.rpm to local mirror
Trace ID: 2828d740-e0ef-11ed-87dd-0050568197df
If you want to view detailed obd logs, please run: obd display-trace 2828d740-e0ef-11ed-87dd-0050568197df
Disable remote ok
Trace ID: 28bb5502-e0ef-11ed-bec9-0050568197df
If you want to view detailed obd logs, please run: obd display-trace 28bb5502-e0ef-11ed-bec9-0050568197df

add auto set env logic to profile: /root/.bash_profile

#####################################################################
 Install Finished 
=====================================================================
Setup Environment:     source ~/.oceanbase-all-in-one/bin/env.sh 
Start Web Service:     obd web 
Quick Start:           obd demo 
More Details:          obd -h 
=====================================================================
[root@CAIP131 bin]# 

image.png

[root@CAIP131 ~]# cd oceanbase-all-in-one/
[root@CAIP131 oceanbase-all-in-one]# cd bin/
[root@CAIP131 bin]# ls
env.sh  install.sh  uninstall.sh
[root@CAIP131 bin]# source ~/.oceanbase-all-in-one/bin/env.sh
[root@CAIP131 bin]# 

image.png

4. 执行 which obd 和 which obclient 检测是否安装成功

如果可以找到 oceanbase-all-in-one 下的 obd 和 obclient 路径,则表示安装成功。

[root@CAIP131 bin]# which obd
/root/.oceanbase-all-in-one/obd/usr/bin/obd
[root@CAIP131 bin]# which obclient
/root/.oceanbase-all-in-one/obclient/u01/obclient/bin/obclient
[root@CAIP131 bin]# 

image.png

二:使用白屏部署 OceanBase 数据库

1、执行 obd web 命令启动白屏界面

根据输出地址登录白屏界面并单击 开启体验之旅 开始部署。

[admin@test001 ~]$ obd web
start OBD WEB in 0.0.0.0:8680
please open http://172.xx.xxx.233:8680

[root@CAIP131 oceanbase-all-in-one]# obd web
start OBD WEB in 0.0.0.0:8680
please open http://172.0.2.1:8680
2023-05-06 16:59:19,067 INFO dispatch (request_response_log.py:40) [76bf983d6d2b4540b8c44a67ec0a44e4] app receive request, method: GET, url: http://172.0.2.1:8680/, query_params: , body: , from: 10.8.0.34:1181
2023-05-06 16:59:19,069 INFO dispatch (request_response_log.py:43) [76bf983d6d2b4540b8c44a67ec0a44e4] app send response, code: 200
2023-05-06 16:59:19,190 INFO dispatch (request_response_log.py:40) [242b813cbc024feaaced7f2137eeb93b] app receive request, method: GET, url: http://172.0.2.1:8680/umi.css, query_params: , body: , from: 10.8.0.34:1181
2023-05-06 16:59:19,191 INFO dispatch (request_response_log.py:40) [1da01ec8da464849987a723127b269cf] app receive request, method: GET, url: http://172.0.2.1:8680/umi.js, query_params: , body: , from: 10.8.0.34:1182
2023-05-06 16:59:19,192 INFO dispatch (request_response_log.py:43) [242b813cbc024feaaced7f2137eeb93b] app send response, code: 200
2023-05-06 16:59:19,199 INFO dispatch (request_response_log.py:43) [1da01ec8da464849987a723127b269cf] app send response, code: 200
2023-05-06 16:59:35,060 INFO dispatch (request_response_log.py:40) [86dc1592d41145c1bcb3b56fa38048a4] app receive request, method: GET, url: http://172.0.2.1:8680/assets/oceanbase.png, query_params: , body: , from: 10.8.0.34:1182
2023-05-06 16:59:35,062 INFO dispatch (request_response_log.py:43) [86dc1592d41145c1bcb3b56fa38048a4] app send response, code: 200
2023-05-06 16:59:35,130 INFO dispatch (request_response_log.py:40) [680bed0b07534640802dd1aef33497bb] app receive request, method: GET, url: http://172.0.2.1:8680/assets/welcome/cover.jpg, query_params: , body: , from: 10.8.0.34:1205
2023-05-06 16:59:35,132 INFO dispatch (request_response_log.py:43) [680bed0b07534640802dd1aef33497bb] app send response, code: 200
2023-05-06 16:59:35,140 INFO dispatch (request_response_log.py:40) [da47d74eca144d15aae343aa4f12736b] app receive request, method: GET, url: http://172.0.2.1:8680/api/v1/deployments?task_status=INSTALLING, query_params: task_status=INSTALLING, body: , from: 10.8.0.34:1204
2023-05-06 16:59:35,140 INFO dispatch (request_response_log.py:40) [5adeb44560754e6c947e23fc34b6bf58] app receive request, method: GET, url: http://172.0.2.1:8680/assets/welcome/data.mp4, query_params: , body: , from: 10.8.0.34:1203
2023-05-06 16:59:35,144 INFO dispatch (request_response_log.py:43) [da47d74eca144d15aae343aa4f12736b] app send response, code: 200
2023-05-06 16:59:35,170 INFO dispatch (request_response_log.py:43) [5adeb44560754e6c947e23fc34b6bf58] app send response, code: 200
2023-05-06 16:59:46,387 INFO dispatch (request_response_log.py:40) [df6a56730e1a48ae99fcab5fe92b2691] app receive request, method: GET, url: http://172.0.2.1:8680/assets/logo.png, query_params: , body: , from: 10.8.0.34:1203
2023-05-06 16:59:46,390 INFO dispatch (request_response_log.py:43) [df6a56730e1a48ae99fcab5fe92b2691] app send response, code: 200

image.png

说明
白屏界面默认使用 8680 端口,您可使用 obd web -p 命令指定端口。

在阿里云或其他云环境下,可能出现程序无法获取公网 IP,从而输出内网地址的情况,此 IP 非公网地址,您需要使用正确的地址访问白屏界面。

2、登录WEB白屏界面
http://172.20.2.131:8680/

image.png

3、精简部署

在 部署配置 界面修改 集群名称 和 部署类型,也可不做修改,使用默认配置。单击 下一步 进入 节点配置 页面。
image.png

4、部署配置

在 节点配置 页面输入机器 IP 和用户密码,单击 下一步 进入 集群配置 页面。

5、节点配置

在 集群配置 页面配置集群的部署模式、密码、目录、端口以及更多配置,您也可不做修改,使用默认配置。单击 下一步 进入 预检查 页面。

image.png

6、集群配置

在 预检查 页面查看配置信息,无误后单击 预检查 进行检查。若预检查报错,您可根据页面建议选择 自动修复 或者单击 了解更多方案 跳转至错误码文档,参考文档自行修改。所有报错修改后,可单击 重新检查 再次进行预检查。
image.png

7、预检查

预检查通过后,单击 部署 开始 OceanBase 集群的部署。部署成功会输出各个组件的连接方式,您可复制进行访问。
image.png

image.png

8、预检问题修复
失败项 1
oceanbase-ce:net
原因:OBD-2007 : 172.20.2.120 tunl0 fail to ping 172.20.2.121. Please check configuration `devname`
建议:自动修复 Please set the network interface corresponding to 172.20.2.120 to `devname`
了解更多方案

image.png
自动修复完成
image.png
部署

image.png

单击 完成,结束部署流程。
image.png

部署过程很酷哦
image.png

部署完成了

image.png

9、查看部署日志

image.png

三、连接 OceanBase 数据库

使用 OBClient 客户端连接 OceanBase 数据库,或者登录 OCP Express 白屏界面管理集群。

1、通过 2881 端口直连数据库

以直连 10.10.10.1 节点为例

[admin@test001 ~]$ obclient -h10.10.10.1 -P2881 -uroot@sys -Doceanbase -A

[root@CAIP131 ~]# obclient -h10.10.10.1 -P3881 -uroot -p -Doceanbase -A
Enter password: 
Welcome to the OceanBase.  Commands end with ; or \g.
Your OceanBase connection id is 3221519016
Server version: OceanBase_CE 4.1.0.0 (r100000192023032010-0265dfc6d00ff4f0ff4ad2710504a18962abaef6) (Built Mar 20 2023 10:12:57)

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]> 

image.png

2、查看数据库
MySQL [oceanbase]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LBACSYS            |
| mysql              |
| oceanbase          |
| ORAAUDITOR         |
| SYS                |
| test               |
+--------------------+
7 rows in set (0.043 sec)

MySQL [oceanbase]> 

部署中途退出 ,再次登录后,可以继续上次的部署

网卡报错

OBD-2007:x.x.x.x xxx fail to ping x.x.x.x. Please check configuration devname
错误原因:机器之间相互 ping 不通。

解决办法:

检查网卡配置是否与实际匹配。
d2d21c803f9a9e4a97750f5c9fa78c0.png

检查各个节点网络是否畅通。

每台机器可能 是不一样,ifconfig 查看一下,填写对应的IP 网卡名就行了,我前天web部署ob也报这个错,不能自动修复,只能手动通过ifconfig 查看,再填写到网卡上面就好了

9f47fb079a52f309bd0d4ae8f3d6c99.png

最后修改时间:2023-05-16 14:33:48
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论