首批通过分布式安全可靠测评,为关键业务系统打造
使用 obd 交互式部署集中式版实践
更新时间:2026-06-26 09:52:48
本文以通过 obd 交互式部署为例,介绍如何进行部署前的资源准备和配置以及如何快速搭建集中式版环境。
在本示例中,OceanBase 集中式数据库和 obd 部署在同一台服务器上,且不包含 obagent、prometheus 和 grafana 组件的部署。
服务器配置
本示例中使用的服务器配置如下所示。
| 类目 | 配置 |
|---|---|
| 服务器数量 | 1 台 |
| CPU | 2 核 x86_64 |
| 操作系统 | Alibaba Cloud Linux,版本为 3 |
| 内核 | 5.10.134-13 |
| 可用内存 | 6G |
| 磁盘 | SSD 存储,空间大小:安装目录 196G、日志保存目录 2T 及数据保存目录 2T。 |
| 安装包 | oceanbase-standalone-all-in-one-4.3.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz |
检查服务器软硬件配置
为确保部署能够顺利完成,在进行部署之前,需要对 OceanBase 数据库使用的服务器软硬件进行检查。
硬件环境
查看 CPU 是否支持 AVX 指令(仅 X86 架构服务器需要)
OceanBase 数据库要求服务器的 CPU 支持 AVX 指令。
通过以下命令检查 CPU 是否支持 AVX 指令。
lscpu | grep Flags | grep avx
返回结果如下:
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local split_lock_detect wbnoinvd dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid fsrm md_clear pconfig flush_l1d arch_capabilities
如上述所示,存在查询结果,说明支持 AVX 指令,如果查询结果为空,则不支持 AVX 指令,需要更换机器。
注意
OceanBase 数据库在 V4.2.5 BP3、V4.2.5 BP4、V4.2.5 BP5、V4.3.5 BP1、V4.3.5 BP2、V4.3.5 BP3 版本增加了对 X86 架构环境运行的指令集要求。OBServer 进程会在启动前检查当前环境是否支持 AVX 指令集,如果缺少该指令集会禁止启动。
OceanBase 数据库自以下版本开始对 AVX 指令集的强制依赖策略已调整:
- 对于 V4.3.5 版本,从 V4.3.5 BP4 版本开始不再强制要求 AVX 指令集支持。
- 对于 V4.2.5 版本,从 V4.2.5 BP6 版本开始不再强制要求 AVX 指令集支持。
查看内存
运行以下命令,查看服务器的可用内存是否满足 准备服务器 中 使用 obd 部署 OceanBase 集中式数据库 所列的可用内存要求。
[root@test001 ~]# free -g
返回结果如下:
total used free shared buff/cache available
Mem: 9 0 9 0 3 6
Swap: 0 0 0
查看此时的 available 所对应的 Mem 值为 6,满足 准备服务器 中 使用 obd 部署 OceanBase 集中式数据库 中部署测试环境所需的最小可用内存要求。如果内存不足时,可以考虑通过 sudo sysctl -w vm.drop_caches=3 或 sudo echo 3 > /proc/sys/vm/drop_caches 清空 Linux 缓存: PageCache、dentries 和 inodes。
软件环境
查看操作系统
运行以下命令,查看操作系统信息。操作系统需要满足 准备服务器 中 软件环境要求 内 OceanBase 数据库操作系统 的要求。
[root@test001 ~]# cat /etc/os-release
返回结果如下:
NAME="Alibaba Cloud Linux"
VERSION="3 (OpenAnolis Edition)"
ID="alinux"
ID_LIKE="rhel fedora centos anolis"
VERSION_ID="3"
VARIANT="OpenAnolis Edition"
VARIANT_ID="openanolis"
ALINUX_MINOR_ID="2104"
ALINUX_UPDATE_ID="10"
PLATFORM_ID="platform:al8"
PRETTY_NAME="Alibaba Cloud Linux 3.2104 U10 (OpenAnolis Edition)"
ANSI_COLOR="0;31"
HOME_URL="https://www.aliyun.com/"
本示例中使用的操作系统为 Alibaba Cloud Linux,版本为 3。
查看内核
OceanBase 集中式数据库目前提供了 X86 版(el7 和 el8)和 ARM 版的安装包。部署之前,请查看服务器的内核以便获取到正确的安装包。
运行以下命令,查看内核信息:
[root@test001 ~]# uname -a
返回结果如下:
Linux xxxxxxxxxxxxxxx.sa128 5.10.134-13.al8.x86_64 #1 SMP Mon Jan 9 10:50:49 CST 2023 x86_64 x86_64 x86_64 GNU/Linux
查看机器的内核为 5.10.134-13,其操作系统版本为 al8,CPU 架构为 x86_64,因此,需要使用后缀为 el8.x86_64.tar.gz 的安装包,例如 oceanbase-standalone-all-in-one-4.3.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz。
获取安装包
通过 obd 和 OCP 部署集中式版使用的安装包是不同的,在获取安装包的时候,务必确保获取到相应的安装包。
可以通过 OceanBase 官网软件下载中心 获取集中式版安装包。该安装包配置有试用版许可证(非生产用途),有效期为 180 天,仅供您进行学习、测试或适配使用,不提供技术支持及 SLA 保障,不得用于营利性、商业性或生产目的。试用许可证过期后,您将无法继续使用数据库功能。如果您需要将软件用于生产环境,或营利性、商业性目的,并需要专业的技术支持保障,请联系 OceanBase 获取商业版许可。
在本示例中,通过 obd 交互式方式进行部署,且对应的机器操作系统版本为 al8,CPU 架构为 x86_64,所以使用的安装包为 oceanbase-standalone-all-in-one-4.3.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz。
部署前配置
为了保证 OceanBase 集中式数据库能够顺利安装和更好地使用,需要在部署前进行以下配置。
创建用户
部署 OceanBase 集中式版推荐使用 admin 用户,也可以使用其他用户(不推荐 root 用户)。但是要求用户具备 sudo 权限和作为数据库相关目录的所有者。
执行以下命令,创建用户组 admin 以及创建用户 admin。
[root@test001 ~]# useradd -U admin -d /home/admin -s /bin/bash [root@test001 ~]# chown -R admin:admin /home/admin执行以下命令,为账户 admin 设置密码。
[root@test001 ~]# passwd admin为账户 admin 设置 sudo 权限。
执行以下命令,打开
/etc/sudoers文件:[root@test001 ~]# vim /etc/sudoers在
/etc/sudoers文件末尾添加如下内容:## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL admin ALL=(ALL) NOPASSWD: ALL查看 admin 用户情况。
sudo -l -U admin返回结果如下:
Matching Defaults entries for admin on sqaobxdn006013051213: syslog=auth, timestamp_timeout=300, !set_logname User admin may run the following commands on sqaobxdn006013051213: (ALL) NOPASSWD: ALL, !/usr/bin/sudo*, !/bin/su*, /bin/su -c*, /bin/su [a-zA-Z0-9]*, !/bin/su *root*, !/bin/sh, !/bin/ash, !/bin/bsh, !/bin/bash, !/bin/csh, !/bin/ksh, !/bin/rsh, !/bin/tcsh, !/bin/zsh, /bin/sh [/~.a-zA-z0-9]*, /bin/sh -c*, /bin/ash [/~.a-zA-z0-9]*, /bin/ash -c*, /bin/bsh [/~.a-zA-z0-9]*, /bin/bsh -c*, /bin/bash [/~.a-zA-z0-9]*, /bin/bash -c*, /bin/csh [/~.a-zA-z0-9]*, /bin/csh -c*, /bin/ksh [/~.a-zA-z0-9]*, /bin/ksh -c*, /bin/rsh [/~.a-zA-z0-9]*, /bin/rsh -c*, /bin/tcsh [/~.a-zA-z0-9]*, /bin/tcsh -c*, /bin/zsh [/~.a-zA-z0-9]*, /bin/zsh -c*通过此查询可以得知,admin 用户拥有了 sudo 权限。
目录规划
部署 OceanBase 集中式版需要规划以下三个目录,同时要求文件系统类型为 XFS 或 EXT4:
- 安装目录:用于安装 OceanBase 集中式数据库运行软件以及保存运行过程中系统日志的目录,空间要求 25G 以上。
- 日志保存目录:用于存放 OceanBase 集中式数据库日志,空间大小要求最小为内存大小的两倍,推荐配置为内存大小的三倍以上 。
- 数据保存目录:用于存储数据,空间要求最小为内存大小的两倍以上,取决于所需存储的数据大小。
注意
如果一个挂载点的目录文件容量大于 16T,仅支持 XFS 类型。
为了保证系统运行的稳定性,推荐以上三个目录分别使用不同的物理盘。如果受限于物理资源,OceanBase 集中式版也支持数据保存目录和日志保存目录共用一块盘,但不推荐用于写入压力比较大的业务场景。
有关磁盘 IOPS 的要求如下:
- 如果安装目录、日志保存目录及数据保存目录分别在不同的磁盘,则要求每个磁盘的 IOPS 不低于 1000。
- 如果安装目录、日志保存目录及数据保存目录在同一磁盘,则要求该磁盘的 IOPS 不低于 3000。
磁盘挂载
如果您所拥有的机器没有需要独立挂载的磁盘,或磁盘已经全部挂载完成,可以跳过此步骤,直接进行下一步目录准备。
在 root 用户下,进行磁盘挂载操作,具体如下:
查看磁盘信息
使用 fdisk -l 命令识别可用磁盘及分区。
[root@test001 ~]# fdisk -l返回结果如下:
Disk /dev/nvme0n1: 3.5 TiB, 3840755982336 bytes, 7501476528 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/nvme1n1: 3.5 TiB, 3840755982336 bytes, 7501476528 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 3DC9B58D-90DC-4B90-869A-33592EA28B9E Device Start End Sectors Size Type /dev/sda1 2048 6143 4096 2M BIOS boot /dev/sda2 6144 415743 409600 200M EFI System /dev/sda3 415744 125829086 125413343 59.8G Linux filesystem Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes使用 lsblk 查看磁盘信息。
[root@test001 ~]# lsblk返回结果如下:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 60G 0 disk ├─sda1 8:1 0 2M 0 part ├─sda2 8:2 0 200M 0 part /boot/efi └─sda3 8:3 0 59.8G 0 part / sdb 8:16 0 200G 0 disk /home sr0 11:0 1 4M 0 rom nvme0n1 259:0 0 3.5T 0 disk nvme1n1 259:0 0 3.5T 0 disk
根据上述查询,可以看到待挂载的磁盘为
/dev/nvme0n1和/dev/nvme1n1。安装 LVM 工具
[root@test001 ~]# yum install lvm2创建物理卷(PV)。
将分区初始化为物理卷。
[root@test001 ~]# pvcreate /dev/nvme0n1 [root@test001 ~]# pvcreate /dev/nvme1n1返回结果如下:
Physical volume "/dev/nvme0n1" successfully created. Physical volume "/dev/nvme1n1" successfully created.验证 PV 创建结果
[root@test001 ~]# pvs返回结果如下:
PV VG Fmt Attr PSize PFree /dev/nvme0n1 lvm2 --- 3.49t 3.49t /dev/nvme1n1 lvm2 --- 3.49t 3.49t
创建卷组(VG)。
合并多个物理卷为一个 VG。
[root@test001 ~]# vgcreate vgob1 /dev/nvme0n1 [root@test001 ~]# vgcreate vgob2 /dev/nvme1n1返回结果如下:
Volume group "vgob1" successfully created Volume group "vgob2" successfully created查看 VG 信息
[root@test001 ~]# vgs返回结果如下:
VG #PV #LV #SN Attr VSize VFree vgob1 1 0 0 wz--n- 3.49t 3.49t vgob2 1 0 0 wz--n- 3.49t 3.49t
创建逻辑卷(LV)。
从 VG 中划分逻辑卷。
创建 data 逻辑卷
[root@test001 ~]# lvcreate -L 2t -n data vgob1返回结果如下:
Logical volume "data" created.创建 log 逻辑卷
[root@test001 ~]# lvcreate -L 2t -n log vgob2返回结果如下:
Logical volume "log" created.
看 LV 信息
[root@test001 ~]# lvs返回结果如下:
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert data vgob1 -wi-a----- 2.00t log vgob2 -wi-a----- 2.00t
格式化和挂载
格式化为 EXT4 文件系统。
格式化 data 逻辑卷为 EXT4 文件。
[root@test001 ~]# mkfs.ext4 /dev/vgob1/data返回结果如下:
mke2fs 1.46.0 (29-Jan-2020) Discarding device blocks: done Creating filesystem with 268435456 4k blocks and 67108864 inodes Filesystem UUID: eb4708c8-e3e3-49b4-9444-b9c81d4be84e Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done格式化 log 逻辑卷为 EXT4 文件。
[root@test001 ~]# mkfs.ext4 /dev/vgob2/log返回结果如下:
mke2fs 1.46.0 (29-Jan-2020) Discarding device blocks: done Creating filesystem with 536870912 4k blocks and 134217728 inodes Filesystem UUID: c48c39cd-bdb9-4635-9304-721dcf013492 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
创建挂载点
[root@test001 ~]# mkdir /data/log1 [root@test001 ~]# mkdir /data/1临时挂载
[root@test001 ~]# mount /dev/vgob2/log /data/log1 [root@test001 ~]# mount /dev/vgob1/data /data/1
设置开机自动挂载。
编辑
/etc/fstab文件,添加挂载配置:[root@test001 ~]# vim /etc/fstab在配置文件中添加如下内容:
/dev/vgob2/log /data/log1 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0 0 0 /dev/vgob1/data /data/1 ext4 defaults,noatime,nodiratime,nodelalloc,barrier=0 0 0查看磁盘挂载情况。
使用以下命令查看磁盘挂载情况。
[root@test001 ~]# df -h返回结果如下:
Filesystem Size Used Avail Use% Mounted on devtmpfs 4.8G 0 4.8G 0% /dev tmpfs 4.8G 0 4.8G 0% /dev/shm tmpfs 4.8G 500K 4.8G 1% /run tmpfs 4.8G 0 4.8G 0% /sys/fs/cgroup /dev/sda3 59G 4.8G 52G 9% / /dev/sda2 200M 5.8M 195M 3% /boot/efi /dev/sdb 196G 3.2G 183G 2% /home tmpfs 970M 0 970M 0% /run/user/1001 /dev/mapper/vgob1-data 2.0T 28K 1.9T 1% /data/1 /dev/mapper/vgob2-log 2.0T 28K 1.9T 1% /data/log1此时可以看到磁盘已经挂载到目录
/data/1和/data/log1下。
目录准备
查看文件系统,是否是 EXT4 或 XFS
[root@test001 ~]# df -Th返回结果如下:
Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 4.8G 0 4.8G 0% /dev tmpfs tmpfs 4.8G 0 4.8G 0% /dev/shm tmpfs tmpfs 4.8G 512K 4.8G 1% /run tmpfs tmpfs 4.8G 0 4.8G 0% /sys/fs/cgroup /dev/sda3 ext4 59G 5.0G 52G 9% / /dev/sdb ext4 196G 113G 74G 61% /home /dev/sda2 vfat 200M 5.8M 195M 3% /boot/efi /dev/mapper/vgob2-log ext4 2.0T 2.1G 1.9T 1% /data/log1 /dev/mapper/vgob1-data ext4 2.0T 2.1G 1.9T 1% /data/1 tmpfs tmpfs 970M 0 970M 0% /run/user/1001根据上述目录查看情况,在部署时选择安装目录为
/home,日志保存目录为/data/log1,数据保存目录为/data/1。查看目录所在的 iops 是否满足要求
说明
此处因安装目录、日志保存目录及数据保存目录分别在不同的磁盘,所以需要在对应的目录下都查询 IOPS 情况。如果安装目录、日志保存目录及数据保存目录为同一磁盘,只需切换到该磁盘的挂载目录下,查询 IOPS 情况。
若服务器中无 fio 工具,可执行
yum install -y fio命令安装。
查看安装目录 IOPS。
切换到安装目录下,执行以下操作:
[root@test001 /home]# fio -filename=./testfile -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k -size=20G -numjobs=1 -runtime=180 -group_reporting -name=sqe_100write_4k --fsync=1 --fallocate=posix返回结果如下:
sqe_100write_4k: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1 fio-3.34 Starting 1 thread Jobs: 1 (f=1): [W(1)][100.0%][w=6648KiB/s][w=1662 IOPS][eta 00m:00s] sqe_100write_4k: (groupid=0, jobs=1): err= 0: pid=145805: Thu May 8 10:39:32 2025 write: IOPS=2012, BW=8051KiB/s (8244kB/s)(1415MiB/180001msec); 0 zone resets clat (usec): min=84, max=3732, avg=174.51, stdev=71.93 lat (usec): min=84, max=3732, avg=174.77, stdev=71.98 clat percentiles (usec): | 1.00th=[ 89], 5.00th=[ 90], 10.00th=[ 91], 20.00th=[ 95], | 30.00th=[ 100], 40.00th=[ 141], 50.00th=[ 184], 60.00th=[ 210], | 70.00th=[ 221], 80.00th=[ 231], 90.00th=[ 265], 95.00th=[ 285], | 99.00th=[ 351], 99.50th=[ 371], 99.90th=[ 441], 99.95th=[ 515], | 99.99th=[ 824] bw ( KiB/s): min= 3432, max=17608, per=100.00%, avg=8056.18, stdev=4234.76, samples=359 iops : min= 858, max= 4402, avg=2014.04, stdev=1058.69, samples=359 lat (usec) : 100=30.58%, 250=57.09%, 500=12.28%, 750=0.04%, 1000=0.02% lat (msec) : 2=0.01%, 4=0.01% fsync/fdatasync/sync_file_range: sync (usec): min=64, max=5690, avg=319.43, stdev=230.86 sync percentiles (usec): | 1.00th=[ 68], 5.00th=[ 69], 10.00th=[ 70], 20.00th=[ 72], | 30.00th=[ 95], 40.00th=[ 194], 50.00th=[ 379], 60.00th=[ 412], | 70.00th=[ 457], 80.00th=[ 474], 90.00th=[ 578], 95.00th=[ 685], | 99.00th=[ 996], 99.50th=[ 1205], 99.90th=[ 1336], 99.95th=[ 1385], | 99.99th=[ 1713] cpu : usr=0.86%, sys=11.80%, ctx=714705, majf=0, minf=0 IO depths : 1=200.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued rwts: total=0,362308,0,362308 short=0,0,0,0 dropped=0,0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs): WRITE: bw=8051KiB/s (8244kB/s), 8051KiB/s-8051KiB/s (8244kB/s-8244kB/s), io=1415MiB (1484MB), run=180001-180001msec Disk stats (read/write): sdb: ios=0/935811, merge=0/335611, ticks=0/164939, in_queue=217509, util=99.97%执行完成上述操作后,请在目录下面删除 testfile 文件,防止磁盘空间不够。
[root@test001 /home]# rm -rf testfile查看日志保存目录 IOPS。
切换到日志保存目录下,执行以下操作:
[root@test001 /data/log1]# fio -filename=./testfile -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k -size=20G -numjobs=1 -runtime=180 -group_reporting -name=sqe_100write_4k --fsync=1 --fallocate=posix返回结果如下:
sqe_100write_4k: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1 fio-3.34 Starting 1 thread Jobs: 1 (f=1): [W(1)][100.0%][w=6648KiB/s][w=1662 IOPS][eta 00m:00s] sqe_100write_4k: (groupid=0, jobs=1): err= 0: pid=145805: Thu May 8 10:39:32 2025 write: IOPS=2012, BW=8051KiB/s (8244kB/s)(1415MiB/180001msec); 0 zone resets clat (usec): min=84, max=3732, avg=174.51, stdev=71.93 lat (usec): min=84, max=3732, avg=174.77, stdev=71.98 clat percentiles (usec): | 1.00th=[ 89], 5.00th=[ 90], 10.00th=[ 91], 20.00th=[ 95], | 30.00th=[ 100], 40.00th=[ 141], 50.00th=[ 184], 60.00th=[ 210], | 70.00th=[ 221], 80.00th=[ 231], 90.00th=[ 265], 95.00th=[ 285], | 99.00th=[ 351], 99.50th=[ 371], 99.90th=[ 441], 99.95th=[ 515], | 99.99th=[ 824] bw ( KiB/s): min= 3432, max=17608, per=100.00%, avg=8056.18, stdev=4234.76, samples=359 iops : min= 858, max= 4402, avg=2014.04, stdev=1058.69, samples=359 lat (usec) : 100=30.58%, 250=57.09%, 500=12.28%, 750=0.04%, 1000=0.02% lat (msec) : 2=0.01%, 4=0.01% fsync/fdatasync/sync_file_range: sync (usec): min=64, max=5690, avg=319.43, stdev=230.86 sync percentiles (usec): | 1.00th=[ 68], 5.00th=[ 69], 10.00th=[ 70], 20.00th=[ 72], | 30.00th=[ 95], 40.00th=[ 194], 50.00th=[ 379], 60.00th=[ 412], | 70.00th=[ 457], 80.00th=[ 474], 90.00th=[ 578], 95.00th=[ 685], | 99.00th=[ 996], 99.50th=[ 1205], 99.90th=[ 1336], 99.95th=[ 1385], | 99.99th=[ 1713] cpu : usr=0.86%, sys=11.80%, ctx=714705, majf=0, minf=0 IO depths : 1=200.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued rwts: total=0,362308,0,362308 short=0,0,0,0 dropped=0,0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs): WRITE: bw=8051KiB/s (8244kB/s), 8051KiB/s-8051KiB/s (8244kB/s-8244kB/s), io=1415MiB (1484MB), run=180001-180001msec Disk stats (read/write): sdb: ios=0/935811, merge=0/335611, ticks=0/164939, in_queue=217509, util=99.97%执行完成上述操作后,请在目录下面删除 testfile 文件,防止磁盘空间不够。
[root@test001 /data/log1]# rm -rf testfile查看数据保存目录 IOPS。
切换到数据保存目录下,执行以下操作:
[root@test001 /data/1]# fio -filename=./testfile -direct=1 -iodepth 1 -thread -rw=write -ioengine=psync -bs=4k -size=20G -numjobs=1 -runtime=180 -group_reporting -name=sqe_100write_4k --fsync=1 --fallocate=posix返回结果如下:
sqe_100write_4k: (g=0): rw=write, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=1 fio-3.34 Starting 1 thread Jobs: 1 (f=1): [W(1)][100.0%][w=6648KiB/s][w=1662 IOPS][eta 00m:00s] sqe_100write_4k: (groupid=0, jobs=1): err= 0: pid=145805: Thu May 8 10:39:32 2025 write: IOPS=2012, BW=8051KiB/s (8244kB/s)(1415MiB/180001msec); 0 zone resets clat (usec): min=84, max=3732, avg=174.51, stdev=71.93 lat (usec): min=84, max=3732, avg=174.77, stdev=71.98 clat percentiles (usec): | 1.00th=[ 89], 5.00th=[ 90], 10.00th=[ 91], 20.00th=[ 95], | 30.00th=[ 100], 40.00th=[ 141], 50.00th=[ 184], 60.00th=[ 210], | 70.00th=[ 221], 80.00th=[ 231], 90.00th=[ 265], 95.00th=[ 285], | 99.00th=[ 351], 99.50th=[ 371], 99.90th=[ 441], 99.95th=[ 515], | 99.99th=[ 824] bw ( KiB/s): min= 3432, max=17608, per=100.00%, avg=8056.18, stdev=4234.76, samples=359 iops : min= 858, max= 4402, avg=2014.04, stdev=1058.69, samples=359 lat (usec) : 100=30.58%, 250=57.09%, 500=12.28%, 750=0.04%, 1000=0.02% lat (msec) : 2=0.01%, 4=0.01% fsync/fdatasync/sync_file_range: sync (usec): min=64, max=5690, avg=319.43, stdev=230.86 sync percentiles (usec): | 1.00th=[ 68], 5.00th=[ 69], 10.00th=[ 70], 20.00th=[ 72], | 30.00th=[ 95], 40.00th=[ 194], 50.00th=[ 379], 60.00th=[ 412], | 70.00th=[ 457], 80.00th=[ 474], 90.00th=[ 578], 95.00th=[ 685], | 99.00th=[ 996], 99.50th=[ 1205], 99.90th=[ 1336], 99.95th=[ 1385], | 99.99th=[ 1713] cpu : usr=0.86%, sys=11.80%, ctx=714705, majf=0, minf=0 IO depths : 1=200.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0% submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0% issued rwts: total=0,362308,0,362308 short=0,0,0,0 dropped=0,0,0,0 latency : target=0, window=0, percentile=100.00%, depth=1 Run status group 0 (all jobs): WRITE: bw=8051KiB/s (8244kB/s), 8051KiB/s-8051KiB/s (8244kB/s-8244kB/s), io=1415MiB (1484MB), run=180001-180001msec Disk stats (read/write): sdb: ios=0/935811, merge=0/335611, ticks=0/164939, in_queue=217509, util=99.97%执行完成上述操作后,请在目录下面删除 testfile 文件,防止磁盘空间不够。
[root@test001 /data/1]# rm -rf testfile
根据上述要求及查询结果得知,每块磁盘的 IOPS 都符合相应的要求。
设置目录权限
部署 OceanBase 集中式版的用户需要作为数据库相关目录的所有者,需要确认磁盘挂载所对应的目录的权限。
进入对应目录,执行如下命令查看相关文件目录权限。
[root@test001 /data]# ls -al返回如下结果:
drwxr-xr-x 4 root root 4096 Apr 28 15:28 . dr-xr-xr-x. 21 root root 4096 Apr 29 15:30 .. drwxr-xr-x 2 root root 4096 Apr 28 15:28 0 drwxr-xr-x 3 root root 4096 Apr 29 15:25 1 drwxr-xr-x 3 root root 4096 Apr 29 15:25 log1若查看目录权限后,发现
admin用户无相关文件的权限,可执行如下命令修改文件所属用户:[root@test001 /data]# chown -R admin:admin /data/log1 [root@test001 /data]# chown -R admin:admin /data/1此时再次查看相关文件目录权限。
[root@test001 /data]# ls -al返回如下结果:
total 20 drwxr-xr-x 5 root root 4096 Apr 29 15:39 . dr-xr-xr-x. 20 root root 4096 Apr 29 15:39 .. drwxr-xr-x 2 root root 4096 Apr 28 15:28 0 drwxr-xr-x 3 admin admin 4096 Apr 29 15:25 1 drwxr-xr-x 3 admin admin 4096 Apr 29 15:25 log1通过上述查询,此时 admin 用户已拥有目录
/data/1和/data/log1的权限。
参数配置
部署前还需对机器做如下配置:
配置 limits.conf
配置 sysctl.conf
关闭防火墙和 SELinux
obd 支持通过主机命令组对主机执行初始化操作,您可选择通过 obd 命令进行上述配置配置,也可选择手动配置。推荐通过 obd 命令配置。
解压安装包。
执行如下命令解压安装包
oceanbase-standalone-all-in-one-4.2.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz。[admin@test001 ~]$ tar -xzf oceanbase-standalone-all-in-one-4.2.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz安装 obd。
进入
oceanbase-standalone-all-in-one的安装目录,执行install_obd.sh脚本安装 obd。[admin@test001 oceanbase-standalone-all-in-one]$ cd oceanbase-standalone-all-in-one [admin@test001 oceanbase-standalone-all-in-one]$ bash bin/install_obd.sh返回结果如下:
Disable remote ok Trace ID: 7bd73a1a-0e08-11f0-b275-00163e49899d If you want to view detailed obd logs, please run: obd display-trace 7bd73a1a-0e08-11f0-b275-00163e49899d add auto set env logic to profile: /root/.bash_profile Execute this command to apply the environment config:`source ~/.oceanbase-all-in-one/bin/env.sh `应用环境配置。
在上述执行结果中,复制
source ~/.oceanbase-all-in-one/bin/env.sh以应用环境配置。source ~/.oceanbase-all-in-one/bin/env.sh配置 limits.conf
[root@test001 ~]$ obd host user init -u admin --host=xxx.xxx.xxx.250 -p ********说明
obd host user init命令为 obd V3.5.0 新增命令,具体介绍可参见 obd 常用命令 中用户初始化内容。该命令执行时会先尝试使用设置的用户(示例中为
admin)登录目标机器(xxx.xxx.xxx.250),若无法连接,则需输入拥有 sudo 权限的用户及密码。obd 会使用输入的用户登录目标机器,并对指定用户执行如下初始化操作:设置 ulimit 参数:修改系统资源限制参数,涉及修改的参数可参见文档 配置 limits.conf。创建用户成功后,可在目标机器上登录创建的用户执行
ulimit -a命令查看配置是否生效。修改目录所有者:若目标机器中存在
/data/1和/data/log1目录,将目录的所有者修改为指定的用户。
配置 sysctl.conf 和关闭防火墙及 SELinux
[admin@test001 ~]$ obd host init admin xxx.xxx.xxx.250 -p ********说明
obd host init命令为 obd V3.3.0 新增命令,具体介绍可参见 obd 常用命令 中主机初始化内容。此处以为使用
admin用户登录xxx.xxx.xxx.250机器并执行初始化操作为例,您需根据实际情况配置登录用户、待初始化主机 IP、登录用户密码(-p)信息。命令具体介绍可参见 obd 常用命令 中主机初始化内容。使用该命令可自动修改部署 OceanBase 数据库时建议修改的内核参数、关闭防火墙和 SELinux 功能,并安装 network 组件。具体修改的内核参数可查看文档 配置 sysctl.conf。
输出如下:
get system config ok +------------------------------------------------------------------------------------------------------+ | System Parameter Change List | +--------------------+-------------------------------------------+---------------+---------------------+ | ip | name | current_value | expected_value | +--------------------+-------------------------------------------+---------------+---------------------+ | xxx.xxx.xxx.250 | fs.aio-max-nr | 65536 | 1048576 | | xxx.xxx.xxx.250 | net.core.somaxconn | 128 | 2048 | | xxx.xxx.xxx.250 | net.core.netdev_max_backlog | 1000 | 10000 | | xxx.xxx.xxx.250 | net.core.rmem_default | 212992 | 16777216 | | xxx.xxx.xxx.250 | net.core.wmem_default | 212992 | 16777216 | | xxx.xxx.xxx.250 | net.core.rmem_max | 212992 | 16777216 | | xxx.xxx.xxx.250 | net.core.wmem_max | 212992 | 16777216 | | xxx.xxx.xxx.250 | net.ipv4.conf.default.rp_filter | 0 | 1 | | xxx.xxx.xxx.250 | net.ipv4.conf.default.accept_source_route | 1 | 0 | | xxx.xxx.xxx.250 | net.ipv4.tcp_rmem | 6291456 | 4096 87380 16777216 | | xxx.xxx.xxx.250 | net.ipv4.tcp_wmem | 16384 | 4096 65536 16777216 | | xxx.xxx.xxx.250 | net.ipv4.tcp_max_syn_backlog | 1024 | 16384 | | xxx.xxx.xxx.250 | net.ipv4.tcp_fin_timeout | 60 | 15 | | xxx.xxx.xxx.250 | vm.min_free_kbytes | 67584 | 2097152 | | xxx.xxx.xxx.250 | fs.file-max | 3205772 | 6573688 | | xxx.xxx.xxx.250 | fs.pipe-user-pages-soft | 16384 | 0 | | xxx.xxx.xxx.250 | vm.max_map_count | 65530 | 655360 | | xxx.xxx.xxx.250 | nofile | 65535 | 655350 | +--------------------+-------------------------------------------+---------------+---------------------+ chown dir ok modify system parameters xxx.xxx.xxx.250: ( fs.aio-max-nr,net.core.somaxconn,net.core.netdev_max_backlog,net.core.rmem_default,net.core.wmem_default... ) have been successfully modified! You must reboot the following servers to ensure the ulimit parameters take effect: (xxx.xxx.xxx.250). Trace ID: f9491158-71db-11f0-81f0-00163e513302 If you want to view detailed obd logs, please run: obd display-trace f9491158-71db-11f0-81f0-00163e513302验证配置
可执行
obd host precheck命令检查主机是否满足要求,该命令会检查sysctl.conf文件中是否存在与建议值不同的内核参数、是否关闭防火墙和 SELinux 功能、/data/1和/data/log1目录的所有者是否为指定的用户等,具体介绍可参见 obd 常用命令 中主机初始化内容。obd host precheck admin xxx.xxx.xxx.250 -p ********若检查项均符合要求,输出示例如下:
get system config ok No need to change system parameters Please run `obd host user init -u admin --host=xxx.xxx.xxx.250` to init user. Please run `obd host init admin xxx.xxx.xxx.250 -p *******` to init host. Trace ID: 22baecfe-71d8-11f0-9467-00163e513302 If you want to view detailed obd logs, please run: obd display-trace 22baecfe-71d8-11f0-9467-00163e513302若存在不符合要求的检查项,输出中将会展示对应信息,您可执行
obd host init命令进行初始化。存在不符合要求的检查项的示例如下:get system config ok [WARN] The owner of the ['/data/1', '/data/log1'] directory is not admin. No need to change system parameters Please run `obd host user init -u admin --host=xxx.xxx.xxx.250` to init user. Please run `obd host init admin xxx.xxx.xxx.250 -p *******` to init host. Trace ID: 4dcae674-7be2-11f0-a2bc-00163e53f118 If you want to view detailed obd logs, please run: obd display-trace 4dcae674-7be2-11f0-a2bc-00163e53f118
配置 limits.conf
在 admin 用户下进行 limits.conf 配置,具体操作如下。
打开
/etc/security/limits.conf进行配置。[admin@test001 /home/admin]# sudo vim /etc/security/limits.conf在
/etc/security/limits.conf配置文件中添加以下内容:* soft nofile 655350 * hard nofile 655350 * soft stack unlimited * hard stack unlimited * soft nproc 655360 * hard nproc 655360 * soft core unlimited * hard core unlimited重启机器。
[admin@test001 /home/admin]# sudo reboot执行以下命令,查看配置是否生效。
[admin@test001 /home/admin]# ulimit -a输出如下。
core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 252876 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 655350 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 655360 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited根据上次查询结果,可以看出:
core file size 表示核心文件的最大阈值(以块为单位),对应
limits.conf配置文件中的 core 参数,需查看值是否为 unlimited。open files 表示最大打开文件描述符数,对应
limits.conf配置文件中的 nofile 参数,需查看值是否为 655350。stack size 表示堆栈大小(以千字节为单位),对应
limits.conf配置文件中的 stack 参数,需查看值是否为 unlimited。max user processes 表示最大用户进程数,对应
limits.conf配置文件中的 nproc 参数,需查看值是否为 655360。
配置 sysctl.conf
在 admin 用户下执行以下命令,打开 /etc/sysctl.conf 配置文件:
[admin@test001 /home/admin]# sudo vim /etc/sysctl.conf
在 /etc/sysctl.conf 配置文件中添加以下内容:
# for oceanbase
## 修改内核异步 I/O 限制
fs.aio-max-nr = 1048576
## 网络优化
net.core.somaxconn = 2048
net.core.netdev_max_backlog = 10000
net.core.rmem_default = 16777216
net.core.wmem_default = 16777216
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_slow_start_after_idle=0
vm.swappiness = 0
vm.min_free_kbytes = 2097152
vm.overcommit_memory = 0
fs.file-max = 6573688
fs.pipe-user-pages-soft = 0
# 修改进程可以拥有的虚拟内存区域数量
vm.max_map_count = 655360
# 设置 core 文件的文件名格式以及目录
kernel.core_pattern = /data/core-%e-%p-%t
更改配置完成后,执行以下命令,加载配置,使配置生效。
[admin@test001 /home/admin]# sudo sysctl -p
关闭防火墙和 SELinux
在 root 用户下面执行以下操作,关闭防火墙和 SELinux。
关闭防火墙
依次执行以下命令,关闭防火墙:
[root@test001 ~]# systemctl disable firewalld [root@test001 ~]# systemctl stop firewalld [root@test001 ~]# systemctl status firewalld关闭 SELinux
执行以下命令,打开
/etc/selinux/config配置文件:[root@test001 ~]# vi /etc/selinux/config在
/etc/selinux/config配置文件中修改对应配置项为以下内容:SELINUX=disabled执行以下命令或重启服务器,使更改生效:
[root@test001 ~]# setenforce 0执行以下命令,查看更改是否生效:
sestatus返回结果如下:
SELinux status: disabled此时说明 SELINUX 已关闭。
使用 obd 交互式部署集中式版
以下操作都在上述新建的 admin 用户下操作。
安装 obd。
注意
解压安装包。
执行如下命令解压安装包
oceanbase-standalone-all-in-one-4.2.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz。[admin@test001 ~]$ tar -xzf oceanbase-standalone-all-in-one-4.2.5_xxx_xxx_xxxxxxxx.el8.x86_64.tar.gz安装 obd。
进入
oceanbase-standalone-all-in-one的安装目录,执行install_obd.sh脚本安装 obd。[admin@test001 oceanbase-standalone-all-in-one]$ cd oceanbase-standalone-all-in-one [admin@test001 oceanbase-standalone-all-in-one]$ bash bin/install_obd.sh返回结果如下:
Disable remote ok Trace ID: 7bd73a1a-0e08-11f0-b275-00163e49899d If you want to view detailed obd logs, please run: obd display-trace 7bd73a1a-0e08-11f0-b275-00163e49899d add auto set env logic to profile: /root/.bash_profile Execute this command to apply the environment config:`source ~/.oceanbase-all-in-one/bin/env.sh `应用环境配置。
在上述执行结果中,复制
source ~/.oceanbase-all-in-one/bin/env.sh以应用环境配置。source ~/.oceanbase-all-in-one/bin/env.sh
查看服务器可用内存。
为了确保能够顺利完成 OceanBase 数据库的安装,安装完 obd 之后安装 OceanBase 数据库之前,建议查询下机器的可用内存,确保可用内存满足数据库的资源要求。
运行以下命令,查看内存:
free -g返回结果如下:
total used free shared buff/cache available Mem: 9 0 9 0 3 6 Swap: 0 0 0此处 available 的 Mem 值为 6,符合部署集中式版的最低可用内存要求。
启动交互式部署安装。
在
oceanbase-standalone-all-in-one的安装目录下,执行install_ob.sh脚本启动交互式安装流程。[admin@test001 oceanbase-standalone-all-in-one]$ bash bin/install_ob.sh填写部署相关信息。
进入交互式安装流程后,需在打印内容的对应位置输入待安装 OceanBase 数据库的相关信息,有关各信息的介绍,可参考文档 使用 obd 部署集中式版 内 使用交互式部署 的 步骤三:启动交互式安装。
Enter the IP (Default: x.xx.xxx.250) (only support local IP): Valid local IP: x.xx.xxx.250 Enter the current user password : Trace ID: 791e745a-2415-11f0-b5f6-00163e09b013 If you want to view detailed obd logs, please run: obd display-trace 791e745a-2415-11f0-b5f6-00163e09b013 get system config ok No need to change system parameters Trace ID: 79d074c0-2415-11f0-9f30-00163e09b013 If you want to view detailed obd logs, please run: obd display-trace 79d074c0-2415-11f0-9f30-00163e09b013 Enter the cluster name (Default: standalone; allowed characters: letters, numbers, and underscores): obtest Enter the OB SQL port (Default: 2881): Enter the OB RPC port (Default: 2882): Enter the obshell port (Default: 2886): Enter the OB root password (Default: So*********7Q7): Confirm the OB root password: Enter the OB cpu count (Default: 2): 8 Enter the OB memory limit (Configurable Range[6, 6], Default: 6, Unit: G): 6 Enter the OB installation directory (Default: /home/admin/obtest): Enter the OB data directory (Default: /data/1/obtest): Enter the OB log directory (Default: /data/log1/obtest): Cluster optimization scenario not specified, please specify the scenario you want to optimize. 1. express_oltp 2. complex_oltp 3. olap 4. htap (default) 5. kv Please input the scenario you want to optimize [default: 4]: The data_dir and redo_dir are using the same disk. Enter the OB datafile maxsize (Configurable Range[12, 142], Default: 142, Unit: G): 50 Enter the OB log disk size (Configurable Range[12, 108], Default: 16, Unit: G): 50 Do you want to create tenant for your business workload? (y/n)(Default: y): y Tenant: sys conifguration: 2C/1G/2G(CPU/Memory/Log disk) system_memory configuration(Unit: G): 1 Enter the tenant name (Default: test; allowed characters: letters, numbers, and underscores): test Please select the tenant mode (enter the corresponding number): 1) MySQL 2) Oracle Please enter your choice [1/2] (default 1):1 Enter the tenant password: Confirm the tenant password: Enter the tenant cpu (Configurable Range[1, 6], Default: 6): 1 Enter the tenant memory (Configurable Range[1, 4], Default: 4, Unit: G): 2 Enter the tenant log disk size(Configurable Range[6, 47], Default: 6, Unit: G): 10 The tenant's log disk size cannot exceed the cluster's available resources (6G). Please try again. Enter the tenant log disk size(Configurable Range[6, 47], Default: 6, Unit: G): Please select the character (enter the corresponding number): 1) utf8mb4 2) utf16 3) gbk 4) gb18030 5) binary Enter the tenant charset (Default: 1): Please select the tenant collation (enter the corresponding number): 1) utf8mb4_general_ci 2) utf8mb4_bin 3) utf8mb4_unicode_ci 4) utf8mb4_unicode_520_ci 5) utf8mb4_croatian_ci 6) utf8mb4_czech_ci 7) utf8mb4_0900_ai_ci Enter the tenant collation (Default: 1): Please select the tenant time zone (enter the corresponding number): 1) -12:00(International Date Line West) 2) -11:00(Samoa Standard Time) 3) -10:00(Hawaii-Aleutian Standard Time) 4) -09:00(Alaska Standard Time) 5) -08:00(Pacific Standard Time) 6) -07:00(Mountain Standard Time) 7) -06:00(Central Standard Time) 8) -05:00(Eastern Standard Time) 9) -04:00(Atlantic Standard Time) 10) -03:00(Brasilia Standard Time) 11) -02:00(Mid-Atlantic Standard Time) 12) -01:00(Azores Standard Time) 13) +00:00(Greenwich Mean Time) 14) +01:00(Central European Time) 15) +02:00(Eastern European Time) 16) +03:00(Moscow Standard Time) 17) +04:00(Gulf Standard Time) 18) +05:00(Pakistan Standard Time) 19) +06:00(Bangladesh Standard Time) 20) +07:00(Indochina Time) 21) +08:00(China Standard Time) 22) +09:00(Japan Standard Time) 23) +10:00(Australian Eastern Standard Time) 24) +11:00(Solomon Islands Time) 25) +12:00(New Zealand Standard Time) 26) +13:00(Tonga Standard Time) 27) +14:00(Line Islands Time) Enter the tenant time zone (Default: 21): Please select case sensitivity for table names: 0) Table names are stored as specified and compared case-sensitively 1) Table names are stored in lowercase and compared case-insensitively 2) Table names are stored as specified but compared case-insensitively Please enter your choice [0/1/2] [default 1]: Do you need to install the monitoring components (OBAgent, Prometheus, Grafana)? (y/n) (Default: y): n #Saved configurations: cluster name: obobtest mysql port: 2881 rpc port: 2882 obshell port: 2886 cpu count: 8 memory limit: 6G home path: /home/admin/obobtest data dir: /data/1/obobtest log dir: /data/log1/obtest datafile maxsize: 80G log disk size: 80G tenant name: test tenant cpu: 1 tenant memory: 1G tenant log disk size: 3G Are you sure these configurations are correct? (y/n) (Default: y): y Configuration confirmed. Do you want to enable encryption for password security (default_encryption_passkey: ******)? [y/n] [Default: n]:配置完上述信息之后,会自动安装数据库等,具体返回内容如下:
start cluster... Cluster param config check ok Open ssh connection ok +----------------------------------------------------------------------------------------------------+ | Packages | +----------------------+---------+------------------------+------------------------------------------+ | Repository | Version | Release | Md5 | +----------------------+---------+------------------------+------------------------------------------+ | oceanbase-standalone | 4.3.5.3 | xxxxxxxxxxxxxxxxxx.el8 | 305669b55281773f5c53ff4e44ff9f7bed9f7bc0 | +----------------------+---------+------------------------+------------------------------------------+ Repository integrity check ok Load param plugin ok Open ssh connection ok Initializes observer work home ok Parameter check ok Remote oceanbase-standalone-4.3.5.3-xxxxxxxxxxxxxxxxxx.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 repository install ok Remote oceanbase-standalone-4.3.5.3-xxxxxxxxxxxxxxxxxx.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 repository lib check ok obtest deployed Get local repositories ok Load cluster param plugin ok Open ssh connection ok [WARN] OBD-1012: (x.xx.xxx.250) clog and data use the same disk (/home) cluster scenario: None Start observer ok observer program health check ok Connect to observer x.xx.xxx.250:2881 ok oceanbase bootstrap ok obshell start ok obshell program health check ok obshell bootstrap ok Connect to observer x.xx.xxx.250:2881 ok Wait for observer init ok +------------------------------------------------+ | oceanbase-standalone | +--------------+---------+------+-------+--------+ | ip | version | port | zone | status | +--------------+---------+------+-------+--------+ | x.xx.xxx.250 | 4.3.5.3 | 2881 | zone1 | ACTIVE | +--------------+---------+------+-------+--------+ obclient -hx.xx.xxx.250 -P2881 -uroot@sys -p'******' -Doceanbase -A cluster unique id: 6a96bf68-e757-5981-a5c3-e70393d5aba5-1967f7e5bce-03050204 obtest running Trace ID: 9869144c-24a5-11f0-a5bb-00163e09b013 If you want to view detailed obd logs, please run: obd display-trace 9869144c-24a5-11f0-a5bb-00163e09b013 create tenant... Get local repositories ok Open ssh connection ok Connect to observer x.xx.xxx.250:2881 ok Create tenant test ok Exec oceanbase-standalone-4.3.5.3-xxxxxxxxxxxxxxxxxx.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 import_time_zone_info.py ok Exec oceanbase-standalone-4.3.5.3-xxxxxxxxxxxxxxxxxx.el8-305669b55281773f5c53ff4e44ff9f7bed9f7bc0 import_srs_data.py ok obclient -hx.xx.xxx.250 -P2881 -uroot@test -Doceanbase -A Trace ID: 61fd9396-24a6-11f0-8c50-00163e09b013 If you want to view detailed obd logs, please run: obd display-trace 61fd9396-24a6-11f0-8c50-00163e09b013 You can access the test tenant using the following command.: obclient -hx.xx.xxx.250 -P2881 -uroot@test -p****** If this cluster is for production use, please import a commercial license in time.验证部署结果
登录 sys 租户
使用上述部署结果中,输出的连接串连接 OceanBase 数据库的 sys 租户
obclient -hxxx.xxx.xxx.250 -P2881 -uroot@sys -p'******' -Doceanbase -A返回结果如下:
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221566257 Server version: OceanBase 4.3.5.3 (r103000112025071821-4b8c513fcc2194bad9eb2f93c789040f6dd01f11) (Built Jul 18 2025 21:12:47) 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(root@sys)[oceanbase]>登录创建的普通租户
使用上述部署结果中,输出的连接串连接 OceanBase 数据库的创建的普通租户
obclient -hxxx.xxx.xxx.250 -P2881 -uroot@test -p******返回结果如下:
Welcome to the OceanBase. Commands end with ; or \g. Your OceanBase connection id is 3221588978 Server version: OceanBase 4.3.5.3 (r103000112025071821-4b8c513fcc2194bad9eb2f93c789040f6dd01f11) (Built Jul 18 2025 21:12:47) 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(root@test)[(none)]>
可以正常连接数据库,说明已经部署完成。